We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Version: 1.2.83.
Steps to reproduce, notice that after serialize and deserialize, $.response is missing.
$.response
JSONObject responseJson = new JSONObject(); responseJson.put("something", "here"); JSONObject dashKeyJson = new JSONObject(); dashKeyJson.put("response", responseJson); // tree map to make sure 'response' refers the object inside '70e4141c-b1dd-4956-a905-1c326a8b8e45' Map<String, Object> parent = new TreeMap<>(); parent.put("70e4141c-b1dd-4956-a905-1c326a8b8e45", dashKeyJson); parent.put("response", responseJson); String jsonStr = JSONObject.toJSONString(parent); // {"70e4141c-b1dd-4956-a905-1c326a8b8e45":{"response":{"something":"here"}},"response":{"$ref":"$.70e4141c\\-b1dd\\-4956\\-a905\\-1c326a8b8e45.response"}} System.out.println(jsonStr); JSONObject deserializedJson = JSONObject.parseObject(jsonStr); // {"70e4141c-b1dd-4956-a905-1c326a8b8e45":{"response":{"something":"here"}}} System.out.println(deserializedJson);
Since fastjson does not support dash in json path, it should be deserialized with ref as:
{"$ref":"$['70e4141c-b1dd-4956-a905-1c326a8b8e45'].response"}
This should fix the issue:
String a = "{\"70e4141c-b1dd-4956-a905-1c326a8b8e45\":{\"response\":{\"something\":\"here\"}},\"response\":{\"$ref\":\"$['70e4141c-b1dd-4956-a905-1c326a8b8e45'].response\"}}\n"; // {"response":{"something":"here"},"70e4141c-b1dd-4956-a905-1c326a8b8e45":{"response":{"something":"here"}}} System.out.println(JSONObject.parseObject(a).toString(SerializerFeature.DisableCircularReferenceDetect));
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Version: 1.2.83.
Steps to reproduce, notice that after serialize and deserialize,
$.response
is missing.Since fastjson does not support dash in json path, it should be deserialized with ref as:
This should fix the issue:
The text was updated successfully, but these errors were encountered: