/r/json

Photograph via snooOG

Anything JSON! JSON is a super simple serialization format that was discovered by Douglas Crockford. It's a subset of JavaScript syntax. It is extremely popular for web and mobile apps. There are implementations in virtually all programming languages, including JavaScript, Ruby, Python, Java, Scala, Clojure, .NET, and Objective C. Some databases, including CouchDB, speak JSON natively.

/r/json

1,829 Subscribers

0

interested in JSON

imm not sure why but i feel like excited and eager to learn JSON, im business student that works in ERP System. FYI, i never learn or know about JSON, i just know its a programing language , is it? and i want to try learn by myself day by day. hopefully i will love it LOL!! i just want to add on my skills and i love to learn new things :) any tips for beginner with zero background for me?

9 Comments
2024/11/14
09:26 UTC

3

Real-World JSON API Challenges? Here's How 'jx' Can Help

Hey r/JSON,

If you’ve ever had to process complex JSON responses from APIs, you know how difficult it can be to manage nested data or filter results efficiently. That’s one of the reasons we built 'jx', a tool that allows you to use JavaScript syntax for JSON manipulation, speeding up development for anyone familiar with the language.

Key Features:

  • API Response Handling: Easily filter, map, and transform API responses in JavaScript.
  • Production-ready: Written in Go for memory safety and stability.
  • Familiar Syntax: Use JavaScript instead of learning jq’s syntax for faster onboarding.

Here’s an example of how 'jx' simplifies working with nested data:

jq: jq '.users[] | select(.active == true) | .profile.email'

jx: jx 'this.users.filter(user => user.active).map(user => user.profile.email)'

If you regularly work with APIs, you’ll find 'jx' faster to pick up and deploy in production environments. You can find more examples and the full documentation on GitHub: github.com/TwoBitCoders/jx. Let me know how it works for you!

0 Comments
2024/11/06
20:12 UTC

1

Converting JSON File into SAV or Excel File

Hello,

I have a huge json data file (300+ MB) that I have opened in OK JSON and I am trying to get about 200 specific observations so that I can put it into SPSS for analysis. Each observation has different sub details that I want to save as well (see image)

I have some limited experience with creating syntax in SPSS and Stata, but I do not have experience using things like Python (which is downloaded onto my computer) or R. For some reason, OK JSON will not let me delete the other observations and the file is too big to import into excel.

If anyone has any advice, that would be much appreciated!

https://preview.redd.it/jzjs9gkj8cyd1.png?width=1110&format=png&auto=webp&s=a791db3c6774c50bb905dc1ac4d04e1eb2f003b1

0 Comments
2024/11/01
19:05 UTC

2

My First JSON: does the "outer level" *have* to be a {}?

I have a .Net object that is a List(Of Actions), where Actions is a CRUD record from a DB. So for instance you might have a delete object with a key, or an update with a key and a List(Of FieldChanges).

As the outermost object is an array, I wrote some JSON using StringBuilder like this...

[
"delete": {"key":12345},
"delete": {"key":54321},
"update": {"key":54321,"field":"Name","value":"Bob Smith"},
etc...
]

JSONLint, an online tool, tells me this is invalid because of the [ ]. Is that true? Does the outermost object in the file have to be a { } collection? If so, how would you handle this case?

I am also curious if this is non-canonical as they are individual entries inside. Would it be "more correct" to do this...
[
"delete": [
{"key":12345},
{"key":54321}
]
"update": [
{"key":54321,"field":"Name","value":"Bob Smith"},
etc...
]
]

Or is it just a matter of personal choice?

5 Comments
2024/10/31
15:16 UTC

2

Video: JSON Patch vs JSON Merge Patch - Overview & Explainer

0 Comments
2024/10/31
10:58 UTC

0

Need help to understand what I do

Guys currently I have assigned to work which involves reading a pdf document using json file and capturing certain fields what exactly am I doing ? I am new to this so just asking

5 Comments
2024/10/30
05:09 UTC

1

help: JSON OBJECT absent on null syntax in Oracle SQL

I have searched many places but I was not able to find an answer. May be it does not exist? I am not sure. Please help.

I have this Oracle SQL code:

declare
    json_obj   JSON_OBJECT_T;
    json_arr   JSON_ARRAY_T;
begin
    -- initialize
    json_obj := json_object_t('{"PHONE_NO":[]}');
    json_arr := json_array_t('[]');

    json_arr := json_obj.get_array('PHONE_NO');

    -- start loop here
    json_arr.append(phonenumber_n);
    -- end loop here

    json_obj.put('NAME', 'JOHN');
    l_return := json_obj.to_string();

The output is like this: -- assuming 2 phone numbers found

{"PHONE_NO":[1235551111, 1235552222], "NAME": "JOHN"}

While this is all good, but what if there is no phone number found in the loop. It will look like this:

{"PHONE_NO":[], "NAME": "JOHN"}

However, I wanted it to look like this:

{"NAME": "JOHN"}

Where do I put the 'ABSENT ON NULL'? Do I manipulate in the L_RETURN?

Thank you very much.

(I hope I got the formatting correct.)

0 Comments
2024/10/30
00:03 UTC

2

Integrating OpenAPIs via JSON Schema based Forms

Curious to hear what you think of the approach described in this article:
https://dashjoin.medium.com/json-schema-openapi-low-code-a-match-made-in-heaven-d29723e543ac

It leverages the JSON Schema from an OpenAPI spec to render a form. The form contents is then POSTed to the API.

3 Comments
2024/10/18
08:52 UTC

1

AWS Glue Catalog Issue

I can't seem to find any helpful info online. Basically, I have an extremely nested json file in my s3 bucket and I want to run a crawler on it. I've already created a classifier with json path $[*], among other attempts. It always seems go fail on "table.storageDescriptor.columns.2.member.type" saying member must have length less than 131072.

I assume glue is inferring the entire file as one gigantic array and I have no idea where to go from here. Anyone have any cloud experience and can offer some guidance?

0 Comments
2024/10/16
16:42 UTC

2

Inventory system that exports to JSON

I'm looking to create an inventory system that exports to JSON for easy and quick file transfer. It's not like a warehouse size of things. 100 different items maybe.

My question is: would that probably be a relatively small file (a few kb) or would that become quite large (over 1mb) for transferring long distances?

1 Comment
2024/10/15
18:53 UTC

1

Needing some assistance

Forgive me for another "help me" post but I'm truly struggling.

At my job i started recently we use two main programs for utility pole loading analysis. One is katapult & the other is SPIDAcal. Shorten visual of work flow for context:

  1. Katapult designers design poles
  2. SPIDA designers use said designs to design 3D models to stress test

Both have APIs but we are currently entering all the information 1 by 1, extremely unproductive. I have access to both of githubs but can't seem to find the information i'm needing. I have very little experience with any of this but am eager to learn. The biggest hurdle is that the two programs use different identifiers for equipment used. It would be a lot easier if our katapult designers entered all the information katapult requires for ease of export. However, management has decided that this would take too long as they have a higher work load. So, i guess i'm looking for a way to make *something* that can export for katapult, read what its saying and translate it in a way that spidacal understands with minimal errors.

Is this possible? Here are the githubs https://github.com/spidasoftware

10 Comments
2024/10/07
23:03 UTC

1

Getting GPX into GeoJSON format

I have some GPX data I would like to format into a GeoJSON format pasted in below. The GPX data is in a dataframe in R, with variables longitude, latitude, elevation, attribute type and summary. I would like some code to format the dataframe so the output is like below. With the feature segment generating a list when the attributeType changes.

TLDR: How do I get GPX data in a readable format to be used here here

const FeatureCollections = [{

"type": "FeatureCollection",

"features": [{

"type": "Feature",

"geometry": {

"type": "LineString",

"coordinates": [

[8.6865264, 49.3859188, 114.5],

[8.6864108, 49.3868472, 114.3],

[8.6860538, 49.3903808, 114.8]

]

},

"properties": {

"attributeType": "3"

}

}, {

"type": "Feature",

"geometry": {

"type": "LineString",

"coordinates": [

[8.6860538, 49.3903808, 114.8],

[8.6857921, 49.3936309, 114.4],

[8.6860124, 49.3936431, 114.3]

]

},

"properties": {

"attributeType": "0"

}

}],

"properties": {

"Creator": "OpenRouteService.org",

"records": 2,

"summary": "Steepness"

}

}];

1 Comment
2024/10/03
22:45 UTC

0

Privelages erorr

Hi, my capabilities file is as follows

{ "dataRoles": [ { "name": "Category", "kind": "Grouping", "displayName": "Brand" }, { "name": "Measure", "kind": "Measure", "displayName": "Percentage" } ], "dataViewMappings": [ { "categorical": { "categories": { "for": { "in": "Category" }, "dataReductionAlgorithm": { "top": {} } }, "values": { "select": [{ "bind": { "to": "Measure" } }] } } } ], "objects": {}, "privileges": { "data": [ "read" ] } }

I get an error when building of "array should be . privilages"

I've run it through chatgpt to try fix and it cycles between array should be .privelages to object should be privileges[0]

Any ideas ?

3 Comments
2024/10/03
22:39 UTC

2

How to get some info from a JSON file

Hello everyone,

I'm trying to get the phone numbers and e-mail adresses of all the town halls in France (there are 35 000 of them).
All of these phone numbers and e-mail adresses are public and gathered in a JSON file issued by the government. The JSON file is for all to use, and it's used by common people in databases, digital phone books, etc.
I would like to extract phone numbers and e-mails with the help of some homemade program. The thing is, I am quite noob at programming. I know the very basics, but that's all.

How should I proceed? Is there a programming language better suited for this ? It seems Python is the way to go. Also, can a noob like me achieve something like this? With the help of chatGPT maybe?

Thank you all in advance for your help.

8 Comments
2024/10/02
18:32 UTC

1

Help

I want to make my expo go react native aplication run on android, but this pops up un expo go:

Uncaught Error: org.json.JSONException: Value <! doctype of type java.lang.String cannot be converted to JSONObject

What can i do??? How can i convert it?

0 Comments
2024/09/27
03:49 UTC

1

How to paste a JSON data in a word file, without losing it's formatting?

Hi All,

I am trying to update a JSON data in a word document, but when I paste it, it is pasted just as normal data, with the color of key/value pairs removed, just updated as normal text. How can I paste it in proper JSON format, withe key/value pairs highlighted in color, etc.,

Thanks,

Gopi

2 Comments
2024/09/20
23:35 UTC

2

How can I emulate a IOS environment?

Hi everyone.
I need to test several JSON files (done from After effects). They work fine in Android, but they don't in IOS. Sending each test to the developer takes a long time. Is there a way to test the files in an IOS environment or simulator from my pc or iPad? (I'm sorry, im a not a programmer, just an animator, so for me this is alien language) thanks.,

0 Comments
2024/09/19
15:57 UTC

1

Help?

Does this mean my phone is being tracked? I don't even know if this is the right place to ask..

{ "title": "Endpoint", "javaType": "com.tmobile.myaccount.consumer.clienttracingconsumer.pojos.ClientSpanEndpoint", "type": "object", "properties": { "serviceName": { "type": "string", "description": "Classifier of this endpoint in lowercase, such as "acme-frontend"" }, "ipv4": { "type": "string", "description": "The text representation of a IPv4 address associated with this endpoint. Ex. 192.168.99.100" }, "ipv6": { "type": "string", "description": "The text representation of a IPv6 address associated with this endpoint. Ex. 2001:db8::c001" }, "port": { "type": "integer" } }, "additionalProperties": false }

0 Comments
2024/09/15
21:56 UTC

0

Rpa.json library

So basically i have a robotfile i have to try the keywrods using slack by creating an app and putting the token of it in the robotfile so i can try the keyword but my problem is that im using library rpa.json but it keeps on showing error on it and saying that its undefined library even tho i download it so when i run the code its not working

0 Comments
2024/09/06
16:13 UTC

1

Can anyone help with this error?

Hi.
Developer team says ther JSON file I send (which is being exported from After effects) gives this error. Does anyone know what it might be related to?
"undefined" != typeof navigator
------------^
Expecting 'EOF', '}', ':', ',', ']', got 'undefined'
thanks!

2 Comments
2024/09/02
15:47 UTC

1

JSON to Java Transformation

I am consuming a third party API in my Spring boot application that returns a JSON payload. Sample below:

{
 //There could be multiple payload type. if payload is of type "order", child element will ONLY be "order_details" (below). 
 
 "payload_type":"order",
  "order_details":{
    "order_id":"123",
    "item_id":"abc",
    "other_fields":"some other fieds related to this order"
  }
 
 //If  payload is of type payment, child element will also have "payment_details" IN ADDITION to "order_details" (below)

 "payload_type":"payment",
  "order_details":{
    "order_id":"123",
    "item_id":"abc",
    "other_fields":"some other fieds related to this order"
  },
   "payment_details":{
    "payment_id":"789",
    "method":{
       "type":"credit_card|paypal"
    },
    //If "type" is "credit_care", then child element will be card_details (as shown below). if "type" is "paypal", then instead of card_details, child element will be "paypal_details". 

     "card_details": {
     "card_number":"1234 5678 ...",
     "exp":"02//2026", 
     "cvv":"123" 
    }
   }


 //If  payload is of type return, child element will also have "return_details" IN ADDITION to  "payment_details" and "order_details" (below)

 "payload_type":"return",
  "order_details":{
    "order_id":"123",
    "item_id":"abc",
    "other_fields":"some other fieds related to this order"
  },
   "payment_details":{
    "payment_id":"789",
    "method":{
       "type":"credit_card|paypal"
    }
  },
  {
    "return_details": "all the child elements for return"
}

I am writing a Java program to parse this JSON. my goal is to write a Java parser program that works like this..

  • Input JSON> If payload is of type "order> Product a java POJO that contains only Order Details.
  • Input JSON> If payload is of type "payment> Product a java POJO that contains Order and Payment Details.
  • Input JSON> If payload is of type "return> Product a java POJO that contains Order, Payment and return Details.

One way I can write this parser is to write a lot of if-else blocks checking the "payload_type" first and then writing the subsequent if-else for all other blocks.

Do you know of any other simpler way to write this mapping from JSON to different Java POJO based on the "payload_type"? Any library or utility that support this level of transformation?

0 Comments
2024/09/01
17:03 UTC

1

JSON embedded images not working.

https://preview.redd.it/ehrxvx4p42ld1.png?width=151&format=png&auto=webp&s=824a4b692c239130c3ef1dfc5458982feda294cb

Hi everyone.
I'm not even a newbie. I'm an illustrator and my client's programmer has required that the animations are sent as a JSON file. I did the animations in After effects.
Ok, so I go a plugin that exports the animation as JSON. The app is being programmed in Figma and they need the images to be embedded in the JSON file. These animations have transparent background, don't know if that is relevant.
The issue first, was the individual animations were way too heavy. So I downsized them to around 250 kg each.
Now the issue seems to be that the stand alone JSON creates an error (waiting on them to send me the error).
So I sent the default JSON file the plug in provides, which creates the attached image's structure.
They say they changed the images URL in the JSON file, but the images are still not showing in the app. I dont know how to attach code to a post but i some explains me how to do it..., could anyone help me here? I cannot afford to lose this client.
Thanks

2 Comments
2024/08/26
19:27 UTC

Back To Top