I have to convert,
string1 : "test1.$.test2",
into
test1:[{
test2:"{value will be assign later in the code}"
}]
I have de structured the string into test1 and test2 using split function, which gives me
- array name = test1
- field name = test2
How do I construct the above format from string? or is there any function in lodash or any npm package I can use?
A.$.B, or can it get more complex? As far as I can tell, it's not any well-known format like JSONPath, so there's probably no library that automatically parses that string for you.