You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I worked for a way to keep the original key order (#4) @grafi-tt you also worked about it (#25).
Both approach use a special table that remind the keys on the fly during a kind of "learning phase"
after that we are using with pairs to get the keys back in the appropriate order.
My probable usual case will be
read a json file (as a config)
change a value
wrote the new json file with the original key order (to have the nice git diff)
If I want to forget the original order for one key...
Is it possible to make :
j = decode( '{"a":"A","zfoo":"F1", "b":"B", "zfoo":"F2", "z":"Z"}' )
j.zfoo = nil -- one to remove the key (not catch by the __newindex handler)
j.zfoo = nil -- one to process the remove request by the __newindex handler
j.zfoo = "F3" -- now we can add the "zfoo" key again
print(encode(j))
to get {"a":"A", "b":"B", "z":"Z", "zfoo":"F3"}
The text was updated successfully, but these errors were encountered:
Hello,
I worked for a way to keep the original key order (#4)
@grafi-tt you also worked about it (#25).
Both approach use a special table that remind the keys on the fly during a kind of "learning phase"
after that we are using with
pairs
to get the keys back in the appropriate order.My probable usual case will be
will be
or
If I want to keep the original order,
should I just make
If I want to forget the original order for one key...
Is it possible to make :
to get
{"a":"A", "b":"B", "z":"Z", "zfoo":"F3"}
The text was updated successfully, but these errors were encountered: