Javascript expert
Budget: $30 – $250 USD
Write a javascript function to convert object string to object.
Something like that
https://stackoverflow.com/questions/69204089/how-to-convert-a-string-with-equal-sign-to-json-in-javascript
This approach works fine for single dimension object type but does not work if string contains multiple dimension array or object.
It should work in this case as well.
Example input:
"{blocktype=LINE, geometry={boundingbox={height=0.015151515151515152, left=0.2376470588235294, top=0.09295454545454546, width=0.5247647058823529}, polygon=[{x=0.2376470588235294, y=0.09295454545454546}, {x=0.29104575163398694, y=0.09295454545454546}, {x=0.29104575163398694, y=0.10810606060606061}, {x=0.2376470588235294, y=0.10810606060606061}]}, id=f5846fa4-fc90-43c2-b3bc-87291ebcd394, page=1, relationships=[{ids=[8088ab30-ed1a-431f-99a9-ad58f0e8eae8, 0de3e425-bb48-4578-b1e0-4c3bbea46350, 8173b284-2ae9-4439-accc-742e10b9d342, 083992de-62bd-4dee-904f-81b4e2b2454c], type=CHILD}], text=510(k) SUBSTANTIAL EQUIVALENCE DETERMINATION}"
Expected output:
{
blocktype: "LINE",
geometry: {
boundingbox: {
height: 0.015151515151515152,
left: ....,
top: ....,
width: ....
},
polygon: [
{
x=...,
y=...,
},
{x=..., y=...},
...
]
},
id: "f5846fa4-fc90-43c2-b3bc-87291ebcd394",
page: 1,
.....
}
Something like that
https://stackoverflow.com/questions/69204089/how-to-convert-a-string-with-equal-sign-to-json-in-javascript
This approach works fine for single dimension object type but does not work if string contains multiple dimension array or object.
It should work in this case as well.
Example input:
"{blocktype=LINE, geometry={boundingbox={height=0.015151515151515152, left=0.2376470588235294, top=0.09295454545454546, width=0.5247647058823529}, polygon=[{x=0.2376470588235294, y=0.09295454545454546}, {x=0.29104575163398694, y=0.09295454545454546}, {x=0.29104575163398694, y=0.10810606060606061}, {x=0.2376470588235294, y=0.10810606060606061}]}, id=f5846fa4-fc90-43c2-b3bc-87291ebcd394, page=1, relationships=[{ids=[8088ab30-ed1a-431f-99a9-ad58f0e8eae8, 0de3e425-bb48-4578-b1e0-4c3bbea46350, 8173b284-2ae9-4439-accc-742e10b9d342, 083992de-62bd-4dee-904f-81b4e2b2454c], type=CHILD}], text=510(k) SUBSTANTIAL EQUIVALENCE DETERMINATION}"
Expected output:
{
blocktype: "LINE",
geometry: {
boundingbox: {
height: 0.015151515151515152,
left: ....,
top: ....,
width: ....
},
polygon: [
{
x=...,
y=...,
},
{x=..., y=...},
...
]
},
id: "f5846fa4-fc90-43c2-b3bc-87291ebcd394",
page: 1,
.....
}