I'm sorry if you interpret the discussion as hate vibe. I'm talking through pros and cons and in my latest posts actually show some deficits about the solution using This_Access.
I reject your alternatives, that's true, but that differs from hate. Of course you can do both. You might find it unelegant to start a list with a comma (and also end it that way) permanently instead of only for the use case of exact search of a property name. To me that's private or hidden and only for internal use, so it's just the concern of the Json implementation, the usage of the objects that result from parsing is still 1:1 and the serialization can turn off the redirection and get at the member list.
You're right that this all is quite academic, but then the major concern of Irwin was trading this little advantage of property order for the speed of the lightweight empty class in comparison to any other base class. Mike mentioned it would be a nice intellectual challenge. That's the only reason I started experimenting with the idea.
I also already warned the order of properties does not prevent that creating the JSON string 1:1 as the original if no value changed will also depend on indentation, tabs, spaces, where you set brackets, etc. So it's not done with that anyway.
I think there would even be a much simpler solution to get back to the original JSON: Just turn it into a template for textmerge by replacing the property values in it to the object members and then it won't matter what amember sorts or not, you'd just textmerge the current object values into the template and you're done. The order and positioning and tabs etc. is preserved.
To make this more concrete, when the JSON parser determines the properties and their values, it can replace those JSON string parts with textmerge placeholders. Well, actually just the values, like this:
Code:
{
"c": "c value"
"a": "a value"
"b": "b value"
}
This could be parsed into an object with a,b,c properties and their values, no matter in which order they are organized, but you siply also store the JSON as template:
Code:
{
"c": "<<object.c>>"
"a": "<<object.a>>"
"b": "<<object.b>>"
}
This should be easy to do while parsing, as you know the property names and values and their positions while parsing and so can use Stuff() to turn the parse JSON into such a textmerge template.
There are pros and cons with that too. If you only ever want to output the same structure it's fine, if you would like to add properties and output them, too, when you serialize, that'll not help. You could even make the object name a variable in this, as textmerge supports recursive processing, ie placeholders within placeholders.
To get to the point, this way you also simply have the JSON as it originally was formatted.
Chriss