开发者

How to determine a match between 2 JSONs?

开发者 https://www.devze.com 2023-02-18 23:30 出处:网络
I have two data sources, and both of them return JSONs. I want to ensure that there is some perce开发者_运维百科ntage of match (overlap of data, if you will) in the two JSONs, so as to collate them a

I have two data sources, and both of them return JSONs.

I want to ensure that there is some perce开发者_运维百科ntage of match (overlap of data, if you will) in the two JSONs, so as to collate them and store in a single record.

Is comparing the entropy of the two strings the best way? Are there any other solutions? I use Java, and could also use scala for the same.


You can convert them to xml and then use xdiff algorithm, or put every json record to a single line, and use unix diff. Or convert it to an internal tree representation, and apply parallel tree difference algorithm. That depends on what kind of difference are you looking for and doesn't depend on the implementation language.

0

精彩评论

暂无评论...
验证码 换一张
取 消