How to atomise nested array type data structure? #1585
-
I have a JSON payload similar to below:
I am stuck on how I would parse this and convert it to atoms or atom families. I would expect to have a couple of groups (atomFamily?) and related to each group a couple of items (another atomFamily?). I can't work out how I'd do this? Do you have atoms within atoms or you have to flatten it somehow and track ids to maintain the relationships. Ultimately I want to edit the groups and items independently of one another, and then convert it back to JSON again. All the tutorials and guides out there only go one level deep with atomFamily and simple lists but there is nothing out there explaining how to go deeper. I am probably approaching this all wrong but any guidance would be much appreciated. It looks like someone on Stack Overflow has a very similar problem: https://stackoverflow.com/questions/68558197/how-to-atomize-complex-structures |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I'd suggest to have an
and |
Beta Was this translation helpful? Give feedback.
I'd suggest to have an
atom
to hold the root and oneatomFamily
for groups and oneatomFamily
for items:and
selectorFamily
to denormalize data back to its original shape.