Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't parse JSON property "null"
    primarykey
    data
    text
    <p>I faced with one trouble when tried to parse JSON "null" property, please help me to understand what's the real problem. I had a following JSON:</p> <pre><code>{ "properties" : { "null" : { "value" : false } } } </code></pre> <p>I used <a href="http://jsonlint.com" rel="nofollow">http://jsonlint.com</a> to validate that this JSON is valid. I tried to parse it from java:</p> <pre><code>import net.sf.json.JSONObject; import java.io.IOException; public class Test { public static void main(String[] args) throws IOException { String st = "{" + " 'properties' : {" + " 'null' : {" + " 'value' : false" + " }" + " }" + "}"; JSONObject.fromObject(st); } } </code></pre> <p>But got the exception:</p> <pre><code>Exception in thread "main" java.lang.ClassCastException: JSON keys must be strings. at net.sf.json.JSONObject._fromJSONObject(JSONObject.java:927) at net.sf.json.JSONObject.fromObject(JSONObject.java:155) at net.sf.json.JSONSerializer.toJSON(JSONSerializer.java:108) at net.sf.json.AbstractJSON._processValue(AbstractJSON.java:238) at net.sf.json.JSONObject._processValue(JSONObject.java:2655) at net.sf.json.JSONObject.processValue(JSONObject.java:2721) at net.sf.json.JSONObject.element(JSONObject.java:1786) at net.sf.json.JSONObject._fromJSONTokener(JSONObject.java:1036) at net.sf.json.JSONObject._fromString(JSONObject.java:1201) at net.sf.json.JSONObject.fromObject(JSONObject.java:165) at net.sf.json.JSONObject.fromObject(JSONObject.java:134) </code></pre> <p>I used json-lib-2.4-jdk15.jar from <a href="http://json-lib.sourceforge.net" rel="nofollow">http://json-lib.sourceforge.net</a> to parse it. Could anybody please clarify this? Why this library throws exception, but online validator said that it's valid JSON? It is a bug in the library or I made something wrong?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload