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
It would be great if new object additions could be specified with a defined property ordering (in formatting options). Something like the insertion function that exists, but for total ordering of existing objects.
This way adding new objects could retain a canonical property ordering with a single call to modify, without having to piece together multiple modify removals and individual modify inserts.
Thanks!
The text was updated successfully, but these errors were encountered:
Ah no, easiest case is just a single insert, but an object insert. For example:
constinputJson='{}';constnewObj: any={};newObj.b='second';newObj.a='first';// a may be added later, but want it to appear before b in the outputconstedits=jsonc.modify(inputJson,['foo'],newObj,{formattingOptions: {}});constoutputJson=jsonc.applyEdits(inputJson,edits);// outputJson (sans indentation) is: { "foo": { "b": "second", "a", "first" } }
It would be great if new object additions could be specified with a defined property ordering (in formatting options). Something like the insertion function that exists, but for total ordering of existing objects.
This way adding new objects could retain a canonical property ordering with a single call to
modify
, without having to piece together multiplemodify
removals and individualmodify
inserts.Thanks!
The text was updated successfully, but these errors were encountered: