facelessuser / SerializedDataConverter

Convert between serialized data formats (plist | json | yaml)
Other
26 stars 4 forks source link

Handle PLIST <date> and <data> elements appropriately #3

Closed facelessuser closed 10 years ago

facelessuser commented 10 years ago

Suggestion from https://github.com/wbond/package_control_channel/pull/2660#issuecomment-32909367

Handle PLIST and elements conversions appropriately both from plist and to plist. Must provide a way to convert back to and as well.

See:

For JSON, there is no easy way to identify plist base64 with 100% certainty. So require base64 to have some unique identifier. Like a dict with a single key, value pair where the key denotes binary data, and the value is the binary data.

{
    "python/object:plistlib.Data": "U29tZSBkYXRh"
}
facelessuser commented 10 years ago

ST3 working on bench. Date converts with no issues between JSON, PLIST, and YAML. Data converts between all three carrying plist data info:

        <data>U29tZSBkYXRh</data>
                {
                    "python/object:plistlib.Data": "U29tZSBkYXRh"
                }
        - !!python/object:plistlib.Data
            data: !!binary |
                U29tZSBkYXRh

ST2 support not implemented yet.

facelessuser commented 10 years ago

ST2 support now in as well.

facelessuser commented 10 years ago

New fixes and cleanup have been applied. This should now work 100%.

Now binary data will just be converted directly to and from this form in YAML:

           -  !!binary |
                U29tZSBkYXRh

Json still converts with the python object since there is no standardized way of storing and recognizing binary data in json.

                {
                    "python/object:plistlib.Data": "U29tZSBkYXRh"
                }