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
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 {...
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 ...
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
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 ...
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
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 ...
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 ...
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 ...
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 ...
1
vote
2answers
172 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=&...
0
votes
2answers
687 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
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 ...
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 ...
0
votes
0answers
121 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 ...
0
votes
2answers
134 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
72 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
259 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
187 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 /...
1
vote
1answer
127 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 ...
0
votes
1answer
386 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
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 ...
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
329 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 ...
1
vote
0answers
408 views

Strategy to Deserialize Json of Unknown type

I find the following dilemma often. Suppose you're retrieving Json messages from a database, message bus, event store or whatever, and you need to deserialize each message into the proper type. ...
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 ...
2
votes
3answers
65 views

Using data to maintain compatibility when evolving RESTful service

I've been reading up on API versioning for REST APIs. Most of the articles I've come across (here's an example) seem to focus on two options: URI based versioning, e.g. v1/my_resource/ Media Type ...
2
votes
2answers
322 views

JSON REST Responses and Embedded Objects

I've been doing some research on RESTful architectures and JSON responses. I'm trying to understand which method of laying out JSON responses is "correct" or if they are both acceptable. For ...
-1
votes
1answer
48 views

With a Web API, list of objects or dictionary with list?

Sorry if the question is worded badly, I couldn't think of a short way of explaining it without examples. My question is if you are hosting a JSON API, which is better: [ { "name": "Foo", "...
0
votes
3answers
65 views

Looking for best practices of storing configurations that will be read/write frequently

I'm writing a couple small python scripts to do tasks and act as 'bots' in some applications that will all read/write things for configuration and some very low-level logging of information; Whats the ...
2
votes
2answers
127 views

Define a complex query in JSON sensibly

A bit of background. We are in the design phase of an HTTP API, and we are facing the question of how to define complex queries in JSON format. We have a items in our product that have A LOT of fields ...
2
votes
2answers
776 views

How do I avoid increased memory consumption by browser and performance degradation when dealing with many records?

In my MVC 5 web application there are many instances in which users will require to view thousands of records within grids, now I managed to get around many performance related issues by utilising the ...
1
vote
2answers
418 views

Returning JPA Entities in Rest Api's?

Recently Ive seen so many devs working with the stack Spring/JPA and returning all these JPA entities on their rest controllers. In my opinion it's a BAD PRACTICE for several reason such: ...
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 ...
0
votes
1answer
125 views

What is the best way to represent data with inheritance?

In my current work, we need to serialize some data and use it later. Our data is in this format: <resources> <style name="Person"> <item name="name">name</item> <...
2
votes
1answer
176 views

Where to store config settings in a text file and when in a database?

I have several web applications. All of them have config files. I'm trying to figure out when it's appropriate to store data in a config file and when in database in json or free format? For instance, ...
2
votes
1answer
158 views

Keeping a JSON copy of a database

I'm new to server-side programming and I'm building a small "test" web application in NodeJS. Each time the clients need to view data from the PostgreSQL database, NodeJS will execute a "SELECT" query ...
0
votes
1answer
435 views

Representing Java Object Hierarchy With Nested Classes

I was working with some API which was used internally, and while looking at their code I found something like this: public class Parent { @Data public static class Child { private ...
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 ...
1
vote
3answers
924 views

Validate JSON on server side

I'm working on Web Application (ASP.Net MVC) that will allow users to edit a JSON object in the browser and save it to database. To do so, JSON object will be sent from view to server side (...
0
votes
0answers
135 views

A program, written in native code, needs to access data, read by a managed DLL

I'm working on an application, which needs to base itself on a DLL, written in managed code (C#), in order to function. That DLL contains type definitions. Therefore a convertor has been written, ...