Create database table from this JSON

Dear All can we create database table from this

 { id: 1, title: "Thomas Williams", label: "Thomas Williams", description: "1", image: "images/photos/t.png" },
        { id: 2, title: "Mary Spencer", label: "Mary Spencer", description: "2", image: "images/photos/m.png" },
        { id: 3, title: "David Kirby", label: "David Kirby", description: "3", image: "images/photos/d.png" },
        { id: 4, title: "Brad Williams", label: "Brad Williams", description: "4", image: "images/photos/b.png" },
        { id: 5, title: "Mike Kirby", label: "Mike Kirby", description: "5", image: "images/photos/m.png" },
        { id: 6, title: "Lynette Maloney", label: "Lynette Maloney", description: "6", image: "images/photos/m.png" },
        { id: 7, title: "Sara Kemp", label: "Sara Kemp", description: "7", image: "images/photos/s.png" },
        { id: 8, title: "Leon Kemp", label: "Leon Kemp", description: "8", image: "images/photos/l.png" },
        { id: 9, parents: [1, 2, 3, 4, 5, 6, 7, 8], title: "Thomas Williams", label: "Thomas Williams", description: "1", image: "images/photos/t.png" },
        { id: 10, parents: [1, 2, 3, 4, 5, 6, 7, 8], title: "Mary Spencer", label: "Mary Spencer", description: "2", image: "images/photos/m.png" },
        { id: 11, parents: [1, 2, 3, 4, 5, 6, 7, 8], title: "David Kirby", label: "David Kirby", description: "3", image: "images/photos/d.png" },
        { id: 12, parents: [1, 2, 3, 4, 5, 6, 7, 8], title: "Brad Williams", label: "Brad Williams", description: "4", image: "images/photos/b.png" },
        { id: 13, parents: [1, 2, 3, 4, 5, 6, 7, 8], title: "Mike Kirby", label: "Mike Kirby", description: "5", image: "images/photos/m.png" },
        { id: 14, parents: [1, 2, 3, 4, 5, 6, 7, 8], title: "Lynette Maloney", label: "Lynette Maloney", description: "6", image: "images/photos/m.png" },
        { id: 15, parents: [1, 2, 3, 4, 5, 6, 7, 8], title: "Sara Kemp", label: "Sara Kemp", description: "7", image: "images/photos/s.png" },
        { id: 16, parents: [1, 2, 3, 4, 5, 6, 7, 8], title: "Leon Kemp", label: "Leon Kemp", description: "8", image: "images/photos/l.png" }

This json generates following family tree

Basic Primitives

Basic Primitives

Basic Primitives Diagrams

Can i create database from this JSON
how can i do it

Reason I need this:
this is hard coded JSON data file
In reality ,
I want to create from database

to do this,
if i know the reverse of this(JSON) i.e. database table structure ,
from database table this JSOn can be generated easily

what I tried

I got following error Parse error on line 1: { id: 0, parent: null,

Expecting ‘STRING’, ‘}’, got ‘undefined’

Same error when i tried https://jsonlint.com/

http://beautifytools.com/json-validator.php

Above JSON code is working properly https://www.basicprimitives.com/usecases/firstfamilychart

Tried https://www.convertjson.com/json-to-sql.htm but getting error

Array name or JSON not valid

This is not json. For exemple, all id should be between “id” .
Also, you have a kind of array but it’s not set into an array. []

I think what you have displayed is more a javascript object and not json

Dear Jici

Thanks a lot for reply

can we create this object programmatically
the way we create JSON
using PHP

That’s newline delimited JSON. JSON’s cousin, so to speak.
You can’t create a Bubble database by passing a JSON, not that I know of.

So what exactly are you trying to achieve?
You want to input what and where and expect what as the output?

In JS toolbox or Plugin, you can use JSON.stringify. Don’t forget you need to wrap this between [] to create an array (this is the case in your link!).
Now you can create DB item, but you cannot import the json directly.

This topic was automatically closed after 70 days. New replies are no longer allowed.