Question:
I have some json that I would like to transform from this:name
field to a key, and the values of the intValue
field to a value. This doesn’t seem like flattening or denormalizing. Are there any tools that might do this out-of-the-box, or will this have to be brute-forced? What’s the most pythonic way to accomplish this?Answer:
{'field1': '1', 'field2': '2', 'fieldN': 'N'}
or as a dict comprehension
name
attribute with the intValue
as key:value pairs, but the result is a dictionary instead of the original input type which was a list.If you have better answer, please add a comment about this, thank you!