-
Notifications
You must be signed in to change notification settings - Fork 265
New issue
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
Code Maintenance: Remove references to JSONObject / JSONArray #1355
Comments
- Issue discussed in RPTools#1355
- Replace JSONObject / JSONArray with gson elements in WebApp - Discussed in RPTools#1355
The JSONArray / JSONObject imports left are:
|
@Merudo So it appears that we could replace the calls in Gson gson = new GsonBuilder().setPrettyPrinting().create();
return gson.toJson(json); The limitation being that it uses a fixed 2 character indent. We would have to create our own JsonPrintFormatter that accepted an indent level. Personally, I'm fine with a fixed 2 char indent. Thoughts? @cwisniew @JamzTheMan Another issue is that it doesn't seem to be handling arrays of objects well but that is perhaps an issue with how the json info is being put together by {
"name": "Candle - 5",
"max range": 10.0,
"type": "NORMAL",
"light segments": [
"{\"facingOffset\":0.0,\"radius\":5.0,\"arcAngle\":360.0,\"isGM\":false,\"ownerOnly\":false}",
"{\"paint\":{\"color\":1677721600},\"facingOffset\":0.0,\"radius\":10.0,\"arcAngle\":360.0,\"isGM\":false,\"ownerOnly\":false}"
]
}, How it looks currently. (Which is actually pretty ugly just without the escaping of quotes.) {
"name": "Candle - 5",
"max range": 10,
"type": "NORMAL",
"light segments": [
{
"facingOffset": 0,
"radius": 5,
"arcAngle": 360,
"isGM": false,
"ownerOnly": false
},
{
"paint": {"color": 1677721600},
"facingOffset": 0,
"radius": 10,
"arcAngle": 360,
"isGM": false,
"ownerOnly": false
}
]
}, |
Im ok with a 2 char indent limitation. I dont see that "breaking" anything major. I almost wish json indenting was the default when ever we print out a var that was a json to be honest... |
It is something weird about how This: [h: myJson = '{"name": "Candle - 5","max range": 10,"type": "NORMAL","light segments":[{"facingOffset": 0,"radius": 5,"arcAngle": 360,"isGM": false,"ownerOnly": false},{"paint": {"color": 1677721600},"facingOffset": 0,"radius": 10,"arcAngle": 360,"isGM": false,"ownerOnly": false}]}']
<pre>[r: json.indent(myJson)]</pre> Works fine with the gson formatter. {
"name": "Candle - 5",
"max range": 10,
"type": "NORMAL",
"light segments": [
{
"facingOffset": 0,
"radius": 5,
"arcAngle": 360,
"isGM": false,
"ownerOnly": false
},
{
"paint": {
"color": 1677721600
},
"facingOffset": 0,
"radius": 10,
"arcAngle": 360,
"isGM": false,
"ownerOnly": false
}
]
} |
There is an extra comma at the end if the original or did you not paste everything? |
It's just a snippet of the whole thing. Found that the light segments are being returned from getInfo() like this:
So that's a separate issue entirely. |
See #1799 for light segments fix. |
Moving to next release. |
Is your feature request related to a problem? Please describe.
Now that 90%+ of the JSON has been converted to gson, it may be a good time to remove all references to JSONObjects / JSONArray.
I found some references in
AppUpdate.java
,MTWebClientManager
,MTWebAppServer
,WebAppInitiative
,WebTokenInfo
, andJSONMacroFunctions
.The text was updated successfully, but these errors were encountered: