convert complex/nested json object to excel table

Viewed 4525

I've got a nested json object. For the sake of simplicity:

data = {'key1': 1, 'key2': 2, 'key3': {'nestedKey1': 3, 'nestedKey2': 4}}

A real object is bigger but the point is that it's a nested one. Values may be strings, numbers or other objects. Now I need to get an excel table that (for this specific json would look like this):

|----------------------------------------
| key1 | key2 |           key3          |
|      |      |--------------------------
|      |      | nestedKey1 | nestedKey2 |
|----------------------------------------
|  1   |  2   |     3      |      4     |
|----------------------------------------

Other formats are also acceptable. But this one is most preferable. How do I do that?

2 Answers

You can convert online(don't know the size limit they allow)

Although it is not exactly in the same format you expect but it is very much similar, you can do little bit of modification from the output you get here. Here is a sample screenshot of the output I got when I inserted your json. enter image description here

Stackoverflow

If you want to write a Service on your own then you can refer to this question on SOF. It is something similar to what you want and it is written in JavaScript.

JQuery

Here is a JQuery script on this page for converting JSON to excel.

Working Stackblitz

Related