Conversion to JSON with DataToDictionary().Convert() is not outputting the new GPS Coordinates data correctly
See original GitHub issueI’m submitting a bug report about the GPS Coordinates getting encoded to JSON incorrectly when doing this
ToSic.Sxc.Conversion.DataToDictionary(false).Convert(App.Data["Location"]);
[x] JS development [x] Content Types or data management [x] APIs like REST
Current behavior
As you can see on line 15 of this output, the GPS coordinates are being encoded as a string with the quotes escaped. Compare that to line 24 and the output of the _2sxcEditInfo
Expected behavior Though obviously we can code around it, I believe this is a bug and needs to be fixed so that the results at line 15 look like this with lattitude and longitude as numbers (not strings).
"GPS": {
"lattitude": 40.123123123,
"logitude": -88.321321321
}
Minimal reproduction of the problem with instructions Just output the 2sxc Content-App 11.03 Location content-type using .Convert() (see above) to JSON.
Please tell us about your environment: 2sxc 11.6.1 on DNN 9.07.02, 2sxc Content App is 11.03 from appx May 15.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Yes, because - you are right - some changes are light/minor. But in the two cases above, fields were added, deleted, and renamed. It’s also hard to answer because your implementation of ‘formula rules’ may also fall way short of my expectations. 😉
as of now, I don’t think we should or can quick-fix this, simply because it’s hard to guess what would break in the wild. Since the value is also a string in razor, requiring
AsDynamic(item.GPS)
to work as an object, we believe it should be clear what’s happening.So we’ll leave it as is.
If somebody would like it to be optimized as pure json coming from the server, just create your own backend.