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
-1
votes
1answer
135 views

How are some websites utilizing .JSON protocols as their web address

https://www.toyota.de/automobile/corolla/index.json I understand how .JSON works but, how is it possible to use that instead of say, .php or .html this is the first time I've seen anything like that.
0
votes
0answers
105 views

How to translate from managed to native class definitions

I have an input file, being the DLL of a C# piece of code, containing managed class definitions. I also have a *.json file, who determines how the conversion should be done. As an example, this is ...
2
votes
2answers
3k views

Maintaining stateful information in REST API

I am developing a REST API which accepts JSON using Spring Boot. I use Spring Security for authentication. I have a use case where I have two services, one to test connection to a 3rd party system and ...
0
votes
2answers
761 views

Design - JSON Strings storing large amounts of data for large amount of users

I have a website that allows users to be "tracked" and track their time/work. This involves the users being able to update their account with my site at most every minute, but typically users do it ...
0
votes
1answer
175 views

Best practices for sending various details about REST resource in a reply from service

We are creating REST API which will be consumed by Web and Mobile users. My question is: do we need to consider user interface before designing the JSON structure? For example, we have one ...
3
votes
3answers
172 views

Should I be lenient with types when accepting JSON data? (String vs number)

Background: So while Javascript implicitly convert various data types and hence may seem almost type-less(is there such a thing?) it does have different types. Most of my colleagues seem to think ...
1
vote
3answers
2k views

Which is a more efficient way of storing data in a database using Objects or strings (Database design)

Which method is better to store the data in a database and why? Here is a restaurant example. I'm using a SQL database and JSON to communicate with the database. Imagine each row is a column in a ...
2
votes
1answer
228 views

How to convey object hierarchy when object is converted to json for updates?

I have some classes being serialized via frugal (this is an open source extension of Thrift). The primary reason this is relevant is that the serialization process is out of my control and needs to ...
3
votes
2answers
61 views

Ajax response — is there an agreement on the structure?

Say, I make an ajax request to a server from a page, something like "show more articles". Is there a common agreement on the format or rather structure in which a result should be returned? Something ...
0
votes
1answer
415 views

Correct way to inform business rules violation during JSON parsing

We have the following scenario in our company: There are some business objects which have business rules associated with them. One of these objects, Person, has the following rules: A Person must ...
0
votes
1answer
162 views

Modeling JSON with Javascript

Using C# I've modeled a JSON message this way: public class MessageBase<T> { public MessageBase() { this.message = new List<T>(); } public string type { get; set; } public ...
-4
votes
4answers
357 views

What are good ways to parse a large amount of input for a C++ application [closed]

For small command line applications I can get away with simple command line input. ./test input.png output.png But for larger applications that requires a lot of input, simply using command line ...
11
votes
7answers
1k views

Is it a good practice to have a special value “ALL” in an enum

I'm developing a new service in a micro-services environment. This is a REST service. For simplicity, let's say that the path is: /historyBooks And the POST method for this path creates a new history ...
0
votes
2answers
627 views

Consuming external APIs within the microservice architecture

I'm writing a small microservice-based application. One of the services is assigned the task of querying an external API and processing the JSON response (filtered list of houses). Since I'm using ...
4
votes
2answers
2k views

Are Unknown JSON Keys a Valid Approach to Sending Data?

There a lot's of SO questions asking "how" to get unknown JSON keys from a JSON object, and I've done it plenty of times, but after starting to use JSON schema to start designing API request and ...
2
votes
1answer
2k views

How to design anti-corruption layer in DDD

I'm getting ready to create an integration with a major external system and was wondering if my understanding of the design pattern for this in domain driven design was solid. Considerations: ...
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 ...
1
vote
2answers
478 views

What are the drawbacks of modeling (unit) test fixtures in JSON instead of using ObjectFactories?

When writing java tests for an application, be they unit tests or testing a broader scope, the java community tends to model fixtures in terms of object factories that produce fixtures of a defined ...
0
votes
1answer
2k views

Comparing Two JSON Files In O(n)

I've got a scenario where I need to compare two JSON files and override one if the values are different. These JSONs also include arrays (i.e. [) My approach is to traverse one JSON to dictionary O(n)...
2
votes
5answers
378 views

Using a workaround instead of going the “standard” way in parsing json

I have been tasked with developing a java application that includes retrieving one property from a json response from a web server. Normally when I parse json I go with the standard way of creating a ...
9
votes
1answer
19k views

How to represent a set in JSON?

JSON supports the following data structures (Java equivalents): Scalar, Array/List, and Map. A Set is not supported out-of-the-box in JSON. I thought about several ways to represent a set in JSON: [...
0
votes
2answers
388 views

Load JSON immediately for SPA instead of AJAX? (Python=>AngularJS)

I have access to a Response object in my python backend for returning HTML pages, etc. I can declare headers, content-type, etc. Instead of re-engineering the Python to use something like Django/...
4
votes
5answers
9k views

Is it ineffecient to store data as json in plain text? [duplicate]

We needed a persistent storage for API keys and I came up with reading and writing json in plain text and the user thinks it works but is it very ineffecient compared to a relational dbms? I just ...
0
votes
3answers
2k views

What approaches can be used to convert existing JSON structure to existing XML structure?

I am working on a component for an enterprise message queue that consumes a message from a queue and sends it as a text message. The message is picked up by my consumer in JSON format (I do not have ...
0
votes
1answer
853 views

What would be a proper implementation of a dictionary in java?

The problem: Let's say I want to create a java app (currently using java 8) that works like a dictionary. I want the app to give the user the capacity to add and search for words, every word must ...
2
votes
1answer
1k views

Best Practice for Potentially Large JSON Numeric Vaues

I raised this issue on the github project for RazorJam.Insightly, where as you can see it turns out that an error is occurring because for the particular items that I am retrieving and deserialising ...
-1
votes
2answers
1k views

MySQL 5.7 json type or MongoDB document?

I'am working on a project that use MySQL as RDBMS. Recently, we have to manipulate a big json data. So, the first solution that comes in mind, and for many reasons, is to cooperate mongoDB with Mysql ...
0
votes
1answer
2k views

JSON data with a key/index for easy searching

Is there any reason not to build JSON data that can be indexed by some key? For example in the WhenIWork API below, using the user's id to quickly access the data? The reason I'm asking is because ...
8
votes
4answers
6k views

Is it a good practice to make API response list of values as dictionary?

I have an API endpoint that returns some statistics. Currently the response looks like: Option 1: { "stats": [ { "name": "some-stats-key1", ...
1
vote
1answer
7k views

How to validate many JSON fields without cluttering up the code with if-checks on each field?

I have a class which contains various fields and they could be accessed with the help of getters and setters like the following public class Student { private String name; private int age; ...
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 ...
13
votes
1answer
16k views

Why would anyone use multipart/form-data for mixed data and file transfers?

I'm working in C# and doing some communication between 2 apps I'm writing. I have come to like the Web API and JSON. Now I am at the point where I am writing a routine to send a record between the two ...
8
votes
1answer
14k views

Base64 in Json: Is it a Good Idea for Rest API?

I am developing a Rest API, and I am asking myself: Is it a good Idea to put base64 encoded data in Json, e.g. for file uploads? What if the base64 contains some of {,},: characters and breaks the ...
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 ...
0
votes
1answer
3k views

How to make sure JSON payload limit does not exceed a certain value during a web request?

I need to call third party APIs where the payload size has a maximum size limit, say, 4 MB. That means I cannot call the API with a payload more than 4MB in size. How can I solve this in an ...
4
votes
2answers
869 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
1answer
30 views

DB: store selected options (including none), with null pointing to a default option

My web users can choose among zero, one or more services (i.e. selectable with checkboxes). The choices should default to only service1. The list of possible services is available via REST API. It ...
-1
votes
1answer
863 views

What is a recommended way to store database information?

I am using a Java to connect to MySQL database. I want to iterate through this data and store it into a data structure. This data structure will be JSON.parse() and converted from server side to ...
0
votes
1answer
73 views

API design - return which operations the user can perform

My Rest API returns a tree structure like this: [ { "name":"test old", "id": 1, "type":"a-object", "spend":13, "status”: “active”, "children":[ { "name":...
1
vote
2answers
152 views

Tabular Website Design with Continuously Added Content

I'm currently working on a site for a friend, converting a google sheet to a webpage (to reduce the time it takes to modify the spreadsheets and apply them to all users). One particular page is ...
1
vote
1answer
420 views

The format of an response in ajax — any convention/recommendations?

Say I have a lot of page with ajax. Is there any convention or recommendation on the format/structure of an ajax response? Namely, if there's an error, a server returns http status 4xx or 5xx and... ...
0
votes
2answers
260 views

Permutations for time in JSON

Let's say that I have a JSON file like at example below. How would I go about finding all possible values of item combination time sums that exist between let's say 00:03:04 to 00:25:55 without ...
4
votes
1answer
449 views

How to solve the problem with various data formats(XML,JSON,SOAP) for data exchange?

We are supporting data exchange in JSON, XML and SOAP for our customers. The bird view of the data flow would be like this Partner 1 sends request for some data with XML data Partner 2 sends request ...
8
votes
5answers
1k views

Rest API Design - Work with IDs or Literal Strings?

When designing a RESTful Web Service should the API be designed to work ID for Strings for values passed back and forth between the server? Here's an example: Let's say I have an Employee resource, ...
-1
votes
1answer
232 views

SOAP and JSON services

Is it possible to produce a web service based on SOAP and on JSON simultaneously? For what I know it seems that only RESTfull services may use JSON
-2
votes
1answer
147 views

What is the “Best Design” for implementing a Command Line which calls ReST API?

Basically I am calling a Server and expect a JSON response. The complication is when I need to pass the parameter which is in the form of JSON. The initial outcome of my thought process was to have a ...
0
votes
1answer
245 views

Hidden troubles with not using JSON, and using Datatables? [closed]

I am currently working on a solution that involves showing millions (a hundred, maybe more) of records from a database, but only a small subset per page (maybe 20-30 records a page) The site has ...
1
vote
0answers
717 views

IPC with Node.js server

I built a post processor for creating CNC machine files to which I'd like to provide a web interface. Currently the program takes a file path as input and then spits out the results into another file....
9
votes
2answers
312 views

Adding to a finite set of options; an API breaking change?

Take an HTTP API endpoint which spits out the following response model: { "type": "Dog", "name": "Jessi", ... } The type field has been described in the documentation as being one of Dog,...
18
votes
1answer
9k views

Why do Microsoft's libraries depend on Newtonsoft.Json?

This had probably started way back when Microsoft created ASP.NET Web API library, at least that's when I remember it if I am not mistaken. Anyway, since then, its HTTP packages started depending on ...