I have a Django database, in which I have some JSON stored. I wish to extract this JSON, parse it, and then apply filters / queries to it. More specifically I want to have a dynamic webpage which displays the JSON sorted, filtered or grouped by the users preference.
From reading the Django documentation I can only see how to use pre-made filters like starts_with, but not how to pre-process the data. I did see the option for applying a regex, but I don’t think I can implement a full JSON parser by hand. I currently parse the JSON and then search it using python classes, but that seems to defeat the purpose of using a database, particularly because it is limited in the types of query it can handle.
The JSON is coming from some other source, and has no guarantees about it’s fields or structure.
Thanks in advance,
jhoyla
The best answer I have been able to come up with is to add the JSON to the database as tables on the fly to get two strings of results (I do it this way because dictionaries aren’t guaranteed to maintain order.)
Giving the result I want, however this only works if the JSON is at most 1 layer deep (although I imagine that this could be fixed it’s pretty hacky already.