Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a Django model called Entity. Different types of Entity have different attributes (e.g. some have a currency associated with them, others don't). I'd rather not have to create a new subclass for every permutation of attributes.

Question: Is it a bad design decision to create a CharField or TextField called "attributes" that uses a JSON-encoded map with the attribute names and values for a given entity?

For the purposes of the answer, assume that I don't have many Entity records (~8,000) or users (~100 at one time, worst case) to deal with, so I'm not sure if the performance hit from dealing with a JSON object is a big problem.

share|improve this question
up vote 1 down vote accepted

As long as your data set is just an JSON encoded string and not delimited in anyway, I don't see why this would be an issue. You may take a performance hit if you have the field as a blob and your constantly making updates to it. Just note you will lose the ability to search by that field if that was a necessity in your design.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.