Looking at https://www.json.org/json-en.html & https://jsonlint.com/ I think the expectation is that the key must be a string and the value must be the json-ised value, so

Dictionary new
	at: 1 put: 2;
	asJsonString 

should result in an error.

Consider the first EBNF diagram on https://www.json.org/json-en.html - it can be simplified for this case to
{ string : jsonised-value}.

Since we're exceptionally clever we could consider doing "make the key be a string of whatever we have" except that trying to reliably convert non-string keys might open up entire pallet-loads of worms. What if somebody is making dictionaries where the keys are complex objects?

Might also want to check on STON as well (https://wiki.squeak.org/squeak/6504). If we're attempting to produce sometihng that meets a standard we should probably actually meet the standard...


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <squeak-smalltalk/squeak-object-memory/issues/109/2030230144@github.com>