Fix javascript script

Job ID: 31505896

Budget: $10 – $30 USD

Hello, I'm trying to work with JSON object data.

There are two kinds of data: 1. Project and 2. Level

Project is the parent of other level entries (they can have no child entries too). And level entries can have other level children.

If you inspect the object, you will find this scenario:

https://i.imgur.com/ie6MXDj.png

When creating each entry, projects take as parent_ID: `"project.id"` which is ok because we want a the same ID (for all these projects):

https://i.imgur.com/SFYHhbf.png

At the top, you see "item_id": This entry unique UUID.
At the bottom, you will see parentID: where this entry is the child of.

-----
-----
-----

**The Problem: The levels**

When the levels are created, the parent ID they use all of them is "parent_ID" because it's the "string" they take on the script, but I would like to add there the "parent" of where they were (if it's a project, take that project.id or if it's another level, use that level.id)

https://i.imgur.com/1UQTMX2.png

Code: https://jsfiddle.net/z39j24xo/)

For more info: please contact direct-message, I reply instant.
Related categories: JavaScript jQuery / Prototype