MarkMindCkm / obsidian-markmind

A mind map, outline for obsidian,It support mobile and desktop
770 stars 35 forks source link

[dev] how to compare the 2 json block/object and sync/update/merge them? thx #686

Closed ccchan234 closed 1 year ago

ccchan234 commented 1 year ago

hi, i think the flow of info could be like this. that i am trying to write a .js to sync/update/merge rich to rich. (I call it merge not replace, MNR.js) image

gpt wrote me a backbone, it did work to ask 2 files, read out the json successfully (better use braces for me). but the json "tree" structure is hard to compare.

i have no idea and gpt cant give a good solution. any help is appreciated to finish this last spot. thx

ccchan234 commented 1 year ago

richs.md image

richt.md image

ccchan234 commented 1 year ago

it turns out the id's are same... isn't they should be random or unique?

that's why the comparison failed....

any help? thx

ccchan234 commented 1 year ago

full richs.md image

ccchan234 commented 1 year ago

the MNR.js script seems is working. it merger rich -> rich. seems is the missing block.

compare json to lines is not needed unless someone demand. thx