0

I recently stumbled over the statement "results should be delivered as a flattened dictionary" in context to JSON-result of a web-service.

While the connection between JSON and (multi-level) Dictionary is clear to me I am confused as to what the flattened form should be. For a single-level dictionary where the values to all keys are objects I suspect the flattened form is merely a list of the objects. However, what is the answer in the generic dictionary where some values are dictionaries once again? Is it a list of all the bottom-level objects?

Thanks for all the support!

  • 1
    I'm guessing it simply means the dictionary should not contain any dictionaries. – Christian Dean Aug 30 '17 at 17:22
  • Thank you Christian - am I right in the assumption that there is no general approach on how to flatten a dictionary with nested dictionaries? –  Aug 31 '17 at 06:32
  • No, there are several Q&A's here dedicated to flattening dictionaries. For example: https://stackoverflow.com/questions/6027558/flatten-nested-python-dictionaries-compressing-keys. – Christian Dean Aug 31 '17 at 11:08

0 Answers0