Skip to content
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

JSON3 does not escape dicts of dicts #297

Open
rengzhengcodes opened this issue Dec 3, 2024 · 2 comments
Open

JSON3 does not escape dicts of dicts #297

rengzhengcodes opened this issue Dec 3, 2024 · 2 comments

Comments

@rengzhengcodes
Copy link

A dictionary that takes dictionaries as keys (very stupid, I know, but it's a quick-and-dirty solution I'm testing), results in improper serialization when writing to file:
"(Dict{String, BigFloat}("lat" => , "lon" => ), Dict{String, BigFloat}("lat" => , "lon" => ))"

Where "lat" and "lon" are originally strings.

@quinnj
Copy link
Owner

quinnj commented Dec 3, 2024

Yeah, we've never really supported non-string-like things for object keys because we short-cut by just calling string(x) on whatever the key is supposed to be. I'll have to think through this a bit more, but we might be able to do something better here.

@rengzhengcodes
Copy link
Author

Thanks! Json.write() seems to exhibit closer to the intended behavior, but the read seems to have issues. Given Stringify is extensionally equivalent for base-objects, it would be rather unsafe but plausible to put a parse clause around the keys instantiating them I believe. Probably could work better with type detection then parsing the arguments but that's a digression.

I'll try to figure something out and come back with a solution for those that make their way here from when this ends up being indexed by google.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants