The issue is to decided the trade offs between following notations:
JSON based:
\"users\": {
\"id1\": {
\"id\": \"id1\",
One big disadvantage of your first "JSON based" notation that comes to mind is that some frameworks will have problems with (de)serialization of this. For example the DataContractSerializer (C# .NET) will expect the fields id1
and id2
to be defined (hardcoded) in the class of your objects users
. I'm not sure if this applies to some Java frameworks, too. Maybe the framework will you use can deserialze it as a HashMap instead.
Altogether I'd find the array notation much more intuitive to work with when it comes to iteration etc.