There is a json like this:
{ \"P1\": \"ss\", \"Id\": 1234, \"P2\": { \"P1\": \"cccc\" }, \"P3\": [ { \"P1\": \"aaa\" }
Converting the JSON to Python and recursively searching is by far the easiest:
def findall(v, k): if type(v) == type({}): for k1 in v: if k1 == k: print v[k1] findall(v[k1], k) findall(json.loads(a), 'P1')
(where a is the string)
The example code ignores arrays. Adding that is left as an exercise.