tags:

views:

81

answers:

4

I have some things that do not need to be indexed or searched (game configurations) so i wa sthinking of storing json on a blob. is this a good idea at all? or are there alternatives?

+2  A: 

No different than people storing XML snippets in a database (that doesn't have XML support). Don't see any harm in it, if it really doesn't need to be searched at the DB level. And the great thing about JSON is how parseable it is.

T.J. Crowder
+4  A: 

If you need to query based on the values within the JSON, it would be better to store the values separately.

If you are just loading a set of configurations like you say you are doing, storing the JSON directly in the database works great and is a very easy solution.

Alan Geleynse
Ya, I do not need the values at all, except for at retrieval. thx
Timmy
and i do have columns for things that needs to be indexed
Timmy
That is fine if you are indexing other columns. As long as the data in the JSON does not need to be indexed you can keep it there. You can always change the database later if you ever want to see how many users have some option set, but I am sure you have more interesting things to work on first.
Alan Geleynse
+2  A: 

I don't see why not. As a related real-world example, WordPress stores serialized PHP arrays as a single value in many instances.

stevelove
A: 

I think,It's beter serialize your XML.If you are using python language ,cPickle is good choice.

mahdieh Saeed
Why? There may be valid reasons, but just saying 'use XXX instead' is not very useful...
StaxMan