Questions tagged [json]

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.

Filter by
Sorted by
Tagged with
0
votes
1answer
154 views

MongoDB mapreduce

I'm new to programming and mongoDB and learning as I go, I'm attempting a mapreduce on a dataset using mongoDB. So far I've converted the csv to json and imported it into a mongoDB using compass. In ...
3
votes
1answer
245 views

Designing a flexible search API response

Quick Summary I'm building a search micro-service that will allow searching across different types of resources in a particular system (e.g. blog posts, users etc.). The API that will be exposed will ...
0
votes
0answers
5 views

How to setup parsing SOAP generated XML files with multi level relation ships to JSON [migrated]

I am dealing with SOAP web service which has Meta Model with multiple/multi-level relationships and adds a complexity of custom XML definition but still based on the Meta Model (to get required ...
1
vote
1answer
23 views

Represent nested resources that has two different type (entites) owners in REST APIs?

Suppose I have a entity called Appointment. This entity represents an medical appointment between one Doctor and one Patient. To create a new Appointment, I send somethind like: POST /appointments {...
0
votes
1answer
521 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 ...
6
votes
6answers
502 views

Should error codes in JSON be integers or strings?

I'm designing a backend webservice, and when an error occurs I'm returning it as a JSON to the frontend. This JSON contains an error code, which the frontend maps to an localized string and shows that ...
1
vote
1answer
76 views

What is the word for the “shape” of json requests/responses? [closed]

For example, what would you name a module containing all of the Pydantic models for your FastAPI project? What would you put as a subtitle in your documentation below an example JSON api response? In ...
2
votes
1answer
2k views

Why is elastic search popular? [closed]

Elastic search is basically about indexing of data. In database world, Multiple indexes can be created on a MongoDB collection Collection in MongoDB can be schema-less. In MongoDB, BSON encoding ...
6
votes
3answers
2k views

Proper Use Of HTML Data Attributes

I'm writing several JavaScript plugins that are run automatically when the proper HTML markup is detected on the page. For example, when a tabs class is detected, the tabs plugin is loaded dynamically ...
-1
votes
2answers
111 views

What does a proper server response look like? [closed]

tl;dr Which is the best server response for an endpoint to get a user's age? 30 or {"age":30} or {"metadata":{"time":1561919615,"status":200},"age":30} or something else? I am writing a server using ...
8
votes
8answers
3k views

Is using something other than XML advisable for my configuration file?

I have a small tool I'm designing which would require a configuration file of some sort. The configuration file in my case is really more of a database, but it needs to be lightweight, and if needed ...
1
vote
1answer
130 views

Handling an empty path variable request

I have a scenario where I can take a student Id as input via a part variable and return some data back as JSON objects where JavaScript handles the response as a part of AJAX call. Suppose the method ...
12
votes
3answers
9k views

Flat or nested JSON for hierarchal data?

I've switched back and forth ~5 times already. This REST endpoint at /api/tags/ will be for internal use (no 3rd party clients), I'm the only one working with it. I'm deciding between these two ...
4
votes
2answers
837 views

Is it a good idea for an API to return only ids from objects?

I have this URL: /api/pallets/list Which returns a JSON array that looks like this: [{ palletId: 333, code: 'J050000081', grower: { growerId: 35, name: 'Grower ...
0
votes
2answers
202 views

Why not program our video text terminals/terminal emulators to use something JSON or XML on the backend instead of ANSI escape sequences? [closed]

Backstory (You can skip) Awhile back I was developing a console toolkit for displaying debug messages and the like: It gives me colour coding, blinking, underlines, bold, italic, etc. While ...
0
votes
2answers
5k views

How deeply can a JSON object be nested?

I was watching a video on a website that said json objects can be nested deeply. How far can a JSON object be nested before it will create an error?
0
votes
1answer
747 views

JSON or XML for parsing for Google Map API

Can someone help me to find a easy way to parse XML? I have an iOS 7 Application using Google Map API. I tried to learn this on my own. I try to create an application that uses Web Services like ...
0
votes
2answers
10k 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....
0
votes
1answer
84 views

Do TCP Sockets need validity/security checks?

I am currently building a distributed system that consists of two separated nodes, connected over wireless Lan. The processes communicate over a bidirectional TCP Socket and JSON messages. For the ...
10
votes
3answers
12k 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
1answer
149 views

When is the point where a JSON text file storage is not enough?

I guess it was Robert C. Martin who campaigned against using SQL in one of his apps, where he was just fine without DB and SQL initially. Later, thanks to the abstraction a DB implementation could be ...
23
votes
4answers
35k views

What is the need of Odata when I have JSON?

I am trying to understand the point of Odata and when it would make sense. Right now how I work is I use ASP.NET and MVC/WebApi controller to serialize/deserialize objects into JSON and have ...
2
votes
2answers
1k views

Is there a canonical way to handle JSON data format changes?

Problem Say we have a C# class with is serialized to JSON (currently via Newtonsoft's JSON.Net) and stored in a database: public class User { public string authInfo; } If the class definition ...
0
votes
0answers
27 views

JSON-RPC Json Objects Best Practices

I am building a JSON-RPC over UDP socket API in Java. There are 6 objects that will be transmitted in JSON: jsonRequest jsonSuccessResponse jsonError jsonErrorResponse jsonNotification ...
1
vote
2answers
173 views

What does the colon before the name mean in this JSON like string?

I encountered this string that looks like JSON syntax but I've never seen a property with a colon before it and not with a backwards greater than or equals sign: Badge { :id=>36, :name=&...
2
votes
1answer
41 views

What is the purpose of adding a schema validation in responses?

Many of the server scripting packages/tools out there have the option to have a schema validation before the response is sent out to the clients. E.g. the fastify package for a Node.js has a pretty ...
0
votes
2answers
697 views

JSON without quotes for keys

I need a textual human readable format which is reasonably compact and version-control friendly to serialize a persistent memory heap. My Bismon system (GPLv3) has such a format (it is textual, human-...
2
votes
2answers
139 views

How to create useful error messages in a JSON REST API without leaking implementation details across layers?

We're implementing a REST service with three main layers: Controller, Domain, Repository. The REST API is supposed to respond to error conditions with meaningful error messages. Suppose the general ...
1
vote
1answer
278 views

Why protobuf is said to be in binary format although we write it in text format similar to json

JSON { "hello": "world" } Protobuf message HelloWorld { required string name = 1; } Why do we say that protobuf uses binary format during network exchange and json don't, even though network ...
1
vote
1answer
54 views

HashMap versus Object ? Which one is better to finally generate JSON output with KEY and VALUE

I do have this use case. callers(APIs in same microservice or different microservices) wants to report different KEYS and VALUES as an audit as part of their methods. There is a high possibilities ...
0
votes
0answers
122 views

Rails Devise & React with Graphsql

I am trying to fix an authorization/authentication strategy for a Rails app (5.2). I am migrating the front-end w/o an API. I have however connected the backend through a GraphQL flow. I am planning ...
7
votes
5answers
29k views

Is it wise to store a big lump of json on a database row

I have this project which stores product details from amazon into the database. Just to give you an idea on how big it is: [{"title":"Genetic Engineering (Opposing Viewpoints)","short_title":"...
0
votes
2answers
135 views

backwards compatibility of REST API for update/patch when adding new fields

Context: Suppose the current way to update a person is to use HTTP PATCH, where you can set the firstname and lastname: { "firstname": "john", "lastname": "doe" } And you want to add an extra ...
0
votes
0answers
101 views

Frontend JSON payload that defines which classes to use in the backend

Payload: { "selection": { "ids": [1,2,3,4,5] }, "image": { "backgroundColor": "#FFFFFF", "headlineColor": "#000000", "format": "PNG" }, "processors"...
0
votes
1answer
74 views

Database design for a survey app [closed]

I'm creating a survey app and I don't know how to design database. I need surveys with multiple questions and multiple types of questions. There are 3 ways that I could think of: a) Create a ...
5
votes
1answer
204 views

When does a JSON object become a burden on memory? [closed]

I'm developing a single page application where the first page contains the subjects and the next one contains items of the chosen subjects. The items are stored in a JSON object fetched from the ...
0
votes
1answer
260 views

What is the original reason JSON used `null` and not `undefined` to represent missing values?

In Javascript, there seems to be or have been an idea that undefined represents a missing primitive OR object value, while null represents just a missing object value. See, for example, this section ...
2
votes
2answers
188 views

Should REST API return escaped user generated content

We have a REST API that returns user generated content from a database. Before inserting the data into the database the data is sanitized. But when returning the data we do not escape / decode the ...
2
votes
1answer
48 views

Content Types of JSON in particular schema

My application stores two different types of json data in s3. For example: Schema-Foo and Schema-Bar. Up to now I used the content-type application/json for both. I would like to make a distinction ...
0
votes
1answer
105 views

Is It good practice on API design to use different object model for getting object and creating

While mostly every company got it's standard on APIs, the question just came out after that one of my colleagues stated we must use different object models for creating and getting objects from API. ...
0
votes
1answer
143 views

Which is better solution - having separate model class against each REST API or keep adding info in single object?

I have a class Person. Person { String firstName; String lastName; String Date dob; String email; String mobileNumber; String address; } To add a person, I have following REST APIs: POST /...
72
votes
7answers
18k views

How bad of an idea is it to use Python files as configuration files?

I've always used JSON files for configuration of my applications. I started using them from when I coded a lot of Java, and now I'm working mainly on server-side and data science Python development ...
0
votes
1answer
388 views

Point-to-Point integration vs ESB

We have a system which has been in development for 10+ years and still continues. It is built as an SOA and use SOAP. We have a new client, internally within our company, who wants to integrate with ...
2
votes
1answer
139 views

Best practice for REST result payload when field may have single or multiple values

I Have a REST API endpoint where the caller can supply some optional filters for the results. GET api/inventory For example, an object member of a GET request may look like the following { "...
0
votes
1answer
105 views

How to build a data-driven menu in JavaScript?

I'm going to attempt to build a data-driven menu for my web-app. The goal is to be able to serve different menu options to different users from an API. The hope is that the server could return a ...
1
vote
1answer
142 views

Strategy to deal with huge data

I have a Spring based java webservice which is returning JSON response. The problem is that the JSON response takes long time because the SQL involved is querying huge chunk of data and it takes 4-5 ...
0
votes
1answer
332 views

Json Deserialization Override Property

Calling out the tech: C#, Newtonsoft.Json. We have a class which contains a property named SchemaVersion that we use to inform of the Json document version once that object is ultimately serialized ...
0
votes
0answers
29 views

JSON in relational DB column for 'custom' data - how to present it on web page

I am creating a generic telemetry system, which records some data about client app usages. Technology used: ASP .NET MVC with EF (code-first) hosted on Azure. There is a requirement to be able to ...
0
votes
1answer
630 views

What is the meaning of MODULE_LICENSE_BSD_LIKE in Android source code? [closed]

In Android source code, we see files like MODULE_LICENSE_APACHE2, MODULE_LICENSE_BSD_LIKE, MODULE_LICENSE_W3C. An outside observer would think that these specify the intended license that applies to ...
2
votes
2answers
124 views

How to model JSON data so it can be easily de-serialized in to simple Java classes?

Context Currently I'm struggling with correctly modeling a small instruction set I want to send as JSON to an Android application to generate a list of UI parts. Right now it's layered as pretty much ...