Construct JSON with schema or based on field names

Hi all,
when you import a json file into Easymorph it shows up smoothly like a table but if you want to rebuild the original json it's not an easy job (usually json files have multiple and "parallel" hierarchical structures).

It could be awesome if you can use the "full JSON path" field names to rebuild the json structure automatically grouping records based on unique values of the sibling fields of the same hierarchical node. This should be possible with both dense/sparse mode.

Another way could be providing a JSON schema of the target json where users can map field names with attribute key/value and Easymorph follows that schema to build the target json.

Schema example (starting from a table <author,book_id,book_name,shop,sell_id, sell_value>) can be:
{
shop: {
"books": [
{ "id": book_id, "title": book_name, "author": author }
],
"sells": {
sell_id: sell_value
}
}
}

This means Easymorph should group by shop, per each group make a distinct list of <book_id,book_name> and a distinct list of <sell_id,sell_value>.

In the full automatic way, to obtain such a file you just have to rename the fields into:
<shop.books[].author,shop.books[].book_id,shop.books[].book_name,shop,shop.sells{key},shop.sells{value}>
where the "{key}" expression can help to fill the key with the column content instead of the static label, and the "{value}" expression can help fill the value with the column contant when scalar (these could be avoided extendeding the "pivot" with multiple data fields like happens with "aggregate").
Maybe adding some more blank columns (ex. shop.books[
], shop.sells) to make the full path schema available can help the implementation:
<shop{key},shop.books[],shop.books[].id,shop.books[].title,shop.books[].author,shop.sells,shop.sells{key},shop.sells{value}>

This feature is an amazing game-changer for using Easymorph in integration data flows where json is king of input AND output.

Thanks for considering. All the best

1 Like

Thank you for the suggestion, @Marco_Ferraresi.

Note that "Import JSON" is not the only way to start working with JSON data. For instance, you can import the source JSON as plain text using the "Import plain text" action, and then modify partially it using the "Modify JSON" action.