JSON (JavaScript Object Notation) aka the Fat Free Alternative to XML is a lightweight data exchange format inspired by JavaScript object literals. It is often used with JavaScript, Ajax, and RESTful web services but is completely language independent.

learn more… | top users | synonyms

1
vote
1answer
68 views

Loading data from JSON file for one time

I have JSON file which has some hundereds of rows stored like below.. [ { "Id": "1", "Name": "A" }, { "Id": "1", "Name": "A" } ] I am trying to load this into collection of ...
1
vote
1answer
60 views

jersey post with a huge payload

I have a requirement to write a POST endpoint where the payload is huge(not normal). In the order 10s of Megabytes. And this endpoint will be accessed by a lot of clients (in the order of 1000s) ...
0
votes
2answers
70 views

Modelling a REST Object Question (Python)

I have a REST API that I want to model in a class so I can access the properties using the dot notation (JS list notation). I explicately defined the properties on my class using the @property tags ...
1
vote
1answer
45 views

Dynamic form builder with serialised sql storage

I have a requirement whereby my users will need to be able to build their own forms. Which they can specify different datatypes: Text DateTime Checkboxes All customisable mandatory/optional. I've ...
3
votes
2answers
165 views

How to represent object references in JSON?

I am trying to figure out what's the best approach when dealing with object references in a JSON to be sent to my server for deserialization. To clarify, what I mean is how to refer to data contained ...
9
votes
5answers
5k views

XSLT equivalent for JSON

I was interested in finding (or if necessary developing) an XSLT equivalent for JSON. As I have not found any, I was considering the possible query language to use for matching JSON paths so as to ...
1
vote
2answers
52 views

Creating a web application with full text search on dynamic data

Even after thorough requirements engineering we end up with users wanting to attach 'notes' to their otherwise well-structured data records, in other words: arbitrary key-value pairs. Their primary ...
2
votes
3answers
1k views

Cache Json on disk with fast read back in java/android

summary: I need a way to cache a large JSONArray on disk, and be able to quickly read AND CONVERT it back to JSONArray at a later time. NOTE: my output MUST be a >>JASONarray<<, and not a ...
5
votes
4answers
368 views

How can I share data across several websites?

I am trying to develop a simple system for sharing data across several websites. Most of them are developed in PHP while some are developed in Wordpress/Drupal. Redundant information is spread across ...
9
votes
2answers
7k views

REST API - Should API Return Nested JSON Objects?

When it comes to JSON APIs is it good practice to flatten out responses and avoid nested JSON objects? As an example lets say we have an API similar to IMDb but for video games. There are a couple ...
2
votes
1answer
617 views

Web application / Domain model integration using JSON capable DTOs

I'm a bit confused about architectural choices for the web-applications/java/python world. For c/c++ world the available (open source) choices to implement web applications is pretty limited to zero, ...
38
votes
14answers
23k views

RESTful API design. What should I return if there are no rows?

I'm currently coding an API for a social network with the Slim Framework. My question is: What are the best practices when there are no rows to return in the json structure? Lets say that this call /...
0
votes
0answers
26 views

The best implementation for fromJson factory method and json-mappings with inheritance?

I have BaseComponent (with field "type") and it's subclasses TextComponent, ListComponent, etc. Some of them has same fields. I want to create them and init their fields from json. Some of possible ...
0
votes
1answer
42 views

How to deal with automatic binding exceptions with Jersey?

It's really nice to have automatic binding with Jersey-Jackson (well, I believe it's actually MOXy the one who manages the bindings), so object serialization and deserialization is done under the hood....
4
votes
1answer
4k views

null vs missing key in REST API Response [closed]

Say in my application, some users give us their last name, and others do not. In a REST API response, which body is preferred: With a "null" value: {"firstName": "Bob", "lastName": null} Or just ...
4
votes
3answers
83 views

GET resource state with JSON body or HTTP code

I want to provide rest api for my iot service to read state of a sprinkler on/off. So far I've come up with two solutions: GET /api/sprinkler that returns 204 if on and 404 if off GET /api/sprinkler ...
2
votes
4answers
887 views

How can I return generated HTML and a response too?

My web application will use AJAX calls often and so I have set up some JavaScript to handle "messages" or "responses". These responses are returned (from my ASP.NET application) as JSON objects that ...
3
votes
4answers
158 views

What JSON structure to use for key value pairs?

What JSON format is a better choice for key value pairs and why? [{"key1": "value1"}, {"key2": "value2"}] Or: [{"Name": "key1", "Value": "value1"}, {"Name": "key2", "Value": "value2"}] Or: {"...
1
vote
0answers
58 views

Two classes which are supposed to be the same, but differ in lists

I am using a 3rd party API which yields JSON which has two ways of loading data - as a list of items, or as a singular item. The problem is that a given item in the list has different properties than ...
-1
votes
1answer
69 views

How do you deal with NULL values while creating jsonObject?

I am learning java and jsr-353. My question is quite forward. Having the method below: public JsonObject createJsonObject() { return Json.createObjectBuilder() .add("address", this....
4
votes
2answers
289 views

Is it bad practice to use hyphens in JSON keys?

I see a lot of questions revolving around accessing JSON keys that use hyphens (kebab-case), but now I find myself wondering should I just stick to camelCase or snake_case in my keys. I know hyphens ...
0
votes
0answers
38 views

Are there any JSON based notations for Access Control Lists? (Alternative to S-Expression)

I'm looking for a notation that is familiar to modern developers and can supersede s-Notation. (additional insight into Rivest's proposal of s-Expression is here) Is there any Swagger, JSON or other ...
4
votes
4answers
262 views

JSON API or Plain JSON

There is a debate in my company on whether we should use the JSON API specification or stick to plain JSON for developing APIs that will be consumed by mobile apps, mainly iOS and Android. One ...
1
vote
1answer
67 views

Data Storage Architecture: Storing Hierarchical Data (JSON/BSON)

Say you have the hierarchical storage concept of "Foo." "Foo" holds an id, various values, and zero to many "Foo." Obviously, in turn, the child elements can hold zero to many Foos. The data is purely ...
1
vote
1answer
39 views

Transfer flattened entities instead of DTOs?

I wonder, if the below idea makes sense for our web application. We show various lists of entities, which typically refer to other entities and so on. In the table view, there are columns showing some ...
2
votes
0answers
57 views

Best way to build a JSON API coupled with HTML views in a Rails project

I've got a Rails eCommerce project communicating with an iOS app. The iOS app receives JSON data from the Rails back-end, but there's also HTML rendering when a user comes to the project from his ...
0
votes
2answers
92 views

JSON or XML or other - most time efficient for largely “read” of structured data

Considering that using a relational DB or other hierarchical or such databases is not an option, looking for the alternative approach using a simple (but very fast, efficient, distributed KV-store). ...
2
votes
2answers
220 views

Is it a bad practice to use JSON strings as keys of objects?

On languages such as Haskell, most datatypes have instances which allow their values to be used as keys of structures such as Maps. JavaScript has reasonably fast maps, there called objects, but those ...
3
votes
3answers
587 views

How can I represent a flowchart, complete with conditional logic using JSON or XML?

One part of a project I'm working on is interactive scripts for call centre staff. Pretty much every possibility I can think of in this case can be represented on paper as a flowchart, which is why I'...
2
votes
3answers
137 views

What is the least bad way of knowing the type of a key from Json file

in our app we have a Json file that contains several properties used for menu configuration. One of the keys should tell us if a menu item should be displayed. The thing is that the value for this key,...
2
votes
2answers
150 views

Reversible Functions

Currently writing a JSON Importer and creating some POJOs based on the data. I also have a requirement to write an JSON Exporter which take the information in the POJOs and exports a JSON doc. To me ...
-1
votes
3answers
183 views

Dealing with API rate limits

I've been using a simple json to the steam API to get player inventory, but now I have discovered that steam impose a rate limit to the number of requests allowed. A rate I feel is not enough for my ...
3
votes
1answer
112 views

Whether to embed linked resources in REST API

I am building a REST API where clients can query user-sent messages, like this: GET http://example.com/api/v1/messages?from=0&to=100 Response: [ { "id": 12345, "text": "...
1
vote
2answers
2k views

API always returns JSONObject or JSONArray Best practices

I'm making an API that will return data in JSON. I also wanted on client side to make an utility class to call this API. Something like : JSONObject sendGetRequest(Url url); JSONObject ...
0
votes
1answer
131 views

multiple api calls vs more complex apis

I have been providing a Web API (.NET MVC 5) of an Oracle Database to people who are making a mobile app. I have to admit that I am not very good at it. I have found that I can easily produce Data ...
1
vote
1answer
134 views

JsonAPI - Updating the relationship for a resource

I am having trouble understanding http://jsonapi.org/. Say, I have the following endpoints in my API for authors and articles. /authors /authors/:id/articles If I wanted to fetch the ...
-1
votes
1answer
88 views

Considerations about returning text instead of JSON in a JSON compliant API [closed]

I'm using Spring-Boot + Jackson to implement a Rest API. When I return some object from my methods the controllers are building a JSON compliant response. However, that's not happening when I return ...
0
votes
2answers
53 views

How to model a property with two different formats and ranges

I am designing a JSON based data schema to describe the visual appearance of blocks similar to HTML elements. It should feel familiar for somebody knowledgable in HTML/CSS but is more restrictive due ...
1
vote
0answers
64 views

How are JSON Web Token validators tested?

JSON Web Tokens (JWTs) are an open, industry standard method for representing claims securely between two parties. There are numerous implementations for JWT verification, but it looks like each ...
1
vote
1answer
116 views

Parsing JSON and creating analytics out of the data, what is the best way to do it?

I am on a project where I call an API and I want to make statistics with the data returned. It returns a big .json object. As that is not possible to flatten, and I am not interested on all the data ...
1
vote
3answers
827 views

Best way to deal with Hibernate 1->Many relationship over REST/JSON service

Problem: A Hibernate bi-directional One-to-Many relationship does not map easily to JSON. If default (Jackson) mapping is used there is an infinite recursion issue as the parent contains the children ...
0
votes
2answers
36 views

Secure authentication using JWT

I read about JWT and how they can provide secure authentication for calling api routes over http. I naively implemented it and here is how it goes : a client posts username and password to a login ...
2
votes
2answers
161 views

Why use JSON dataset rather than SQL Query?

A colleague was asking me to explain a system information flow, as they are having problems with the wrong information being presented. It seems that what they have created is a custom built website, ...
-1
votes
3answers
199 views

What is a correct way to exchange information between “frontend” and “backend”? [closed]

I am not so experienced in client-server applications and I could not find exactly answer to my question anywhere in google. I am developing part of application on server side and my collegue who ...
1
vote
2answers
295 views

Design consideration on JSON schema for an API

I have an API endpoint that retrieve data from 3 SQL tables on the server-side. At the moment, I do a SELECT with joins, consolidate/reorganize the selected data based on a JSON schema, and then send ...
1
vote
0answers
35 views

How do I minimize the number of database queries in a GeoJson API (of countries, and smaller areas) with custom data?

The general version of the question is above - a a little more detail, I am using Django Rest Framework, but am happy for answers to be dealing with the problem in abstract. So, I have data with ~200 ...
2
votes
3answers
6k views

An ideal way to decode JSON documents in C?

Assuming I have an API to consume that uses JSON as a data transmission method, what is an ideal way to decode the JSON returned by each API resource? For example, in Java I'd create a class for each ...
2
votes
1answer
165 views

Suggestions for structuring complex json structures?

I can't find many tips for how to design complex json structures beyond the obvious tips of not trying to nest too deeply, using defined data types, etc. For example, if I have a location that needs ...
3
votes
1answer
2k views

How do I resolve $ref in a JSON object?

I have written a single page application that uses rest services to retrieve JSON objects. The JSON objects being returned are C# objects serialized using the Newtonsoft.JSON library. The returned ...
5
votes
2answers
572 views

How Should I Design JSON Serializable Data Classes To Respect Future @NonNull Fields

I have an app that uses Gson to serialize/deserialize data classes and persist data between runs. My code uses @NonNull annotations for many fields/parameters/method returns and one thing that was ...