Convert nested JSON into database entries

Hi everyone,

I’m struggling to convert a JSON with nested values into entries in my database using backend workflows or APIs.

I’ve looked around this forum, played with trying to make a plug-in, but still can’t figure it out. So this is a call for help please in the hopes someone has done this already!

If I start with a JSON like this:
[
{ “item1”: { “nestedKey1”: “nestedValue1” } },
{ “item2”: { “nestedKey2”: “nestedValue2” } },
{ “item3”: { “nestedKey3”: “nestedValue3” } }
]

How can I turn that JSON with 3 items, into three separate database entries where the nestedKeys are a field in the database?

The approach I’ve tried is to create a plug-in with backend actions to turn the JSON into a bubble-friendly list, with the intention of running an API workflow on that list to get it into the database.

But I can’t figure out how to turn the JSON into a bubble-friendly list using backend actions of a plugin.

Thanks!

Not to sound like a jerk, but the forum is riddled with this question and solutions. Seems like it is asked at least once a week.

Just do a forum search and you’ll find the solution.

2 Likes

that’s not jerky. I have tried the forum and a few different plugins and am still struggling. I’m not sure what I’m missing here. There’s a lot of questions about JSON, but I can’t find anything around how to use backend workflows with JSON to get items into a database. Especially nested JSON items into database fields

I think this video will help you :https://www.youtube.com/watch?v=4CE21Xn7fgI

Thanks @amer ! I had checked this one out before as well and given it a shot.

I think the issue I’m having is that I want to turn this:
[
{ “item1”: { “nestedKey1”: “nestedValue1” } },
{ “item2”: { “nestedKey2”: “nestedValue2” } },
{ “item3”: { “nestedKey3”: “nestedValue3” } }
]

Into three database entries, each of which have a field called “JSON” that should have:
Entry 1. { “item1”: { “nestedKey1”: “nestedValue1” } }
Entry 2. { “item2”: { “nestedKey2”: “nestedValue2” } }
Entry 3. { “item3”: { “nestedKey3”: “nestedValue3” } }

And each of those JSONs may have different keys and structures.

I’m looking into it more, and I realise the issue I’m having may be that ‘raw body text’ - which I think I could use - doesn’t actually get returned properly, so all I’m getting is ‘nulls’.

Looks like it may be a bug or I’m doing something wrong. Will dig into it deeper:

Looping back here for anyone who happens upon this thread.

I ended up solving this by creating a custom plug-in. Ping me if you want to know more about how I did it. :slight_smile:

Here is a thread from 1 day ago