python - Serializing form data - picke or XML? -


i trying save form data, , wondering if should use python's native pickle, or sort of xml serializer. wanted use django's serializers these seem geared @ working wit models, not regular python dictionaries/objects.

the object want serialize composed entirely of strings (and possibly integers) , this:

data = { 'var1': "foo", 'var2': "bar", 'var3': ['bar', 'foo', 'moo', 'fish'], 'var4': 42 } 

and want save because need able render html page based on these values @ point in future.

should go ahead saving pickled object - or should save xml? don't see advantages of using xml, since not planning access outside of django. making wrong decision?

few notes:

  • this not want save in session or cache, because want keep history of these forms indefinitely
  • the format/layout of forms subject change making db schema hold information impractical.

what json ? it's lightweight, readable, portable, , serialization/deserialization dead simple basic types (strings, ints, dicts, lists).

i try hard possible stick normalized db schemas, few occasions storing serialzed stuff "less worse" solution, go json, @ least can use data programming languages.


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -