I have a draft containing JSON. When I use writeJSON in a Draft action, the resulting file is not organized the same as what I see in my draft.
If the draft is:
{
"Fruit Number": 1,
"Fruit Name": "apple",
"Fruit Types": [
{
"Type": "Golden Delicious",
"Type Number": 1
},
{
"Type": "Granny Smith",
"Type Number": 2
}
],
"Has Seeds": true
}
When I write the file using writeJSON, the file is:
{
"Fruit Number": 1,
"Fruit Types": [
{
"Type": "Golden Delicious",
"Type Number": 1
},
{
"Type": "Granny Smith",
"Type Number": 2
}
],
"Fruit Name": "apple",
"Has Seeds": true
}
“Fruit Name” has jumped down the list to above “Has Seeds.” Not the biggest deal in terms of parsing JSON, but using a diff function in Visual Studio Code, it’s registering the position change as a change, when I’d really only like to see real content changes.
Anything I’m doing wrong here or could be doing differently so that the exported draft looks exactly like what I’m seeing in Drafts? I can use writeString instead, but then slashes aren’t escaped and the spacing around colons is a little different, and I end up with the same problem in the diff editor.
Thanks all!