My project is currently receiving a JSON message in python which I need to get bits of information out of. For the purposes of this, let's set it to some simple JSON in a string:
jsonStr = '{"one" : "1", "two" : "2", "three" : "3"}'
So far I've been generating JSON requests using a list and then json.dumps
, but to do the opposite of this I think I need to use json.loads
. However I haven't had much luck with it. Could anyone provide me a snippet that would return "2"
with the input of "two"
in the above example?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…