@ComplexPoint (or anyone else):
Consider this action:
Here's the action's plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>Action</key>
<string>DisplayWindow</string>
<key>MacroActionType</key>
<string>InsertText</string>
<key>StyledText</key>
<data>
cnRmZAAAAAADAAAAAgAAAAcAAABUWFQucnRmAQAAAC4jAQAAKwAAAAEAAAAb
AQAAe1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcY29jb2FydGYxNDA0XGNvY29h
c3VicnRmNDcwCntcZm9udHRibFxmMFxmbmlsXGZjaGFyc2V0MCBIZWx2ZXRp
Y2FOZXVlO30Ke1xjb2xvcnRibDtccmVkMjU1XGdyZWVuMjU1XGJsdWUyNTU7
fQpccGFyZFx0eDU2MFx0eDExMjBcdHgxNjgwXHR4MjI0MFx0eDI4MDBcdHgz
MzYwXHR4MzkyMFx0eDQ0ODBcdHg1MDQwXHR4NTYwMFx0eDYxNjBcdHg2NzIw
XHBhcmRpcm5hdHVyYWxccGFydGlnaHRlbmZhY3RvcjAKClxmMFxmczI2IFxj
ZjAgSGVsbG8gd29ybGQufQEAAAAjAAAAAQAAAAcAAABUWFQucnRmEAAAANqr
VVi2AQAAAAAAAAAAAAA=
</data>
<key>Text</key>
<string>Hello world.</string>
</dict>
</array>
</plist>
Notice the <data>
datatype. This datatype occurs in other places, like macros that have icons, for instance.
If I try to convert it to JSON, here's what I get:
[
{
"Action": "DisplayWindow",
"MacroActionType": "InsertText",
"Text": "Hello world.",
"StyledText": {}
}
]
Notice what it did to "StyledText". Do you have any thoughts on how to fix this?
I know that I could use a "replacer" function in JSON.stringify() to have <data>
types stored as a string, but I don't know how to return it to <data>
when I eventually convert it back to a plist (so I can paste it back into KM, for example).
Any ideas? I can think of some bastardizations, but nothing that wouldn't "smell" really badly.