Linked Questions
21 questions linked to/from Representing null in JSON
1 vote
1 answer
1k views
C#/JSON What to do with a NULL value returned from a DB query? [duplicate]
Situation: I am building a Web API that queries a database and then returns the results via JSON. There are a couple of columns that are being introduced to the table, but do not have data populated ...
10 votes
2 answers
19k views
JSON.parse allows null as value
I am passing null to JSON.parse() and although the first parameter is documented saying that it should be a string value, it still works to supply null. How come this does not throw an error even ...
7 votes
2 answers
36k views
What is the JSON Standard for an empty string or null variable?
I'm building an application that parses a JSON template and then replaces the values of the objects with new data. My question is what is the standard way to represent empty data in JSON? This is how ...
16 votes
3 answers
1k views
Why doesn't WCF/JSON return `null` for a null return value?
According to the JSON spec, the correct way to represent a null value is the literal null. If that is the case, why does WCF return an empty response instead of null? Is this a bug or is this ...
2 votes
1 answer
5k views
JsonDeserializer No Processing Null Values
I am not able to get JsonDeserializer to process null values. I have a json file I am reading from where there are just four values for my record type: Case 1, Case 2, *, or null. JsonDeserializer ...
2 votes
3 answers
1k views
Remove items from a dictionary if condition is met
I have a dictionary dict1 from which I want to remove all items where b is null, that means not just the property b, but the whole dictionary. - hosts: localhost gather_facts: false vars: ...
6 votes
1 answer
4k views
How to differentiate null value fields from absent fields in jackson library
We are consuming an API and the api is providing xml fields. We have to convert xml to json for our consumers. We have a requirement of showing just what we have got as XML and to display only those ...
0 votes
2 answers
6k views
How to replace undefined with null or treat it as false in javascript?
So I'm having this little generator, the info that get displayed should correspond to what values are populated on the database, the example below is a physical address this.setState({ ...
3 votes
1 answer
3k views
Is there a standard way to indicate an invalid value in an ISO8601-formatted timestamp?
I have some code that creates an ISO8601-formatted timestamp but if the incoming date is in an invalid format, the conversion fails. I'd like to know if there's a standard way of representing an ...
2 votes
4 answers
1k views
What does the "{}" mean in Javascript? [closed]
In javascript, we can initialise a variable with {}. What does the "{}" mean? var o = {}; o.getMessage = function () { return 'This is an example'; }; return o;
1 vote
3 answers
2k views
How to parse "{}" empty value (into String)
Given json: { "name" : {} } I would like to parse it into the following Java object using com.fasterxml.jackson: class MyClass { private String name; } If you try it, you will get: com....
0 votes
2 answers
658 views
save and load nullable strings in JSON files
for my Unity game I created a JSON file that holds the speedrun times. The saved times are Timespan strings. When loading the data I parse the strings to Timespan values. When saving the time I save ...
-1 votes
1 answer
1k views
Default behavior for a JSON Serializer if it is passed null?
I have an ISerializer interface with several different implementations and a simple contract: string Serialize<T>(T data); T Deserialize<T>(string serializedData); One of the ...
2 votes
1 answer
748 views
Json null data behaving strangely
I am using grails 2.3.3 in a development and I'm having a problem working with a 2 dimensional array that has been taken from a json web page. The particular problem occurs when there are null values ...
0 votes
1 answer
310 views
Swagger API "required" - how much is this required?
I've created a Swagger (on nodejs/express) test API with this specification (only relevant part): ... parameters: - name: name in: query required: true type: string ... But I can call ...