You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi Andres @aalmiray, in the latest verion 3.0.0, in function JSONObject.element(key, value), if the input value is a valid JSON formatted string, it will still output a string instead of converting it to JSONObject/JSONArray. But if the string is "null", it will be transformed to a JSONNull, which I think it maybe unreasonable, so I fix it to output the string "null".
However, in function JSONArray.element(), if the string is a valid JSON formatted string, it will be transformed to a JSONArray/JSONObject/JSONNull.
/** * Append a String value. This increases the array's length by one.<br> * The string may be a valid JSON formatted string, in tha case, it will be * transformed to a JSONArray, JSONObject or JSONNull. * * @param value A String value. * * @return this. */publicJSONArrayelement(Stringvalue) {
returnelement(value, newJsonConfig());
}
It is because of this way of handling the input string in JSONArray that we can never get an JSONArray like this: ["null", "string"]...
Hi Andres @aalmiray, in the latest verion 3.0.0, in function
JSONObject.element(key, value)
, if the input value is a valid JSON formatted string, it will still output a string instead of converting it to JSONObject/JSONArray. But if the string is "null", it will be transformed to a JSONNull, which I think it maybe unreasonable, so I fix it to output the string "null".However, in function
JSONArray.element()
, if the string is a valid JSON formatted string, it will be transformed to a JSONArray/JSONObject/JSONNull.It is because of this way of handling the input string in JSONArray that we can never get an JSONArray like this: ["null", "string"]...
I wonder why the function of
element()
in JSONArray and JSONObject handle the input value in diffrent way?The text was updated successfully, but these errors were encountered: