Key-value pair serialization vs. JSON, XML, etc -
Key-value pair serialization vs. JSON, XML, etc -
a naive question: developers, periodically have need save info disk. few, few 10s, or few 100s values. people utilize xml, utilize json, sense old ini-file format
key1=value1
key2=value2
meets needs best. files readable, 1 can utilize text-processing on them, diffs in version command work well.
yet, seems key=value not popular in serialization. overlooking something?
it depends on you're trying values. json, can nest arrays of objects (each own sets of name/value pairs) in concise format. xml, can nest objects, , each object can have number of attributes (which end beingness name/value pairs).
so comes downwards matter of style.
do like:
[{name="john", last="smith", salary="100"},{name="mary",last="smith",salary="200}]
or
<people> <person name="john" last="smith" salary="100" /> <person name="mary" last="smith" salary="200" /> </people>
or
[person1] name=john last=smith salary=100 [person2] name=mary last=smith salary=200
i think if need searching , filtering, xml format you. if you're using info within javascript or sending , different services, json preferred format. , if it's info need work internally, ini file format fine.
probably not want hear, but, in opinion, depends.
xml json serialization dictionary yaml
Comments
Post a Comment