Go Back   Scooter Forums > Beyond Compare 3 Discussion > Other Session Types
Register FAQ Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
  #1  
Old 17-Dec-2011, 11:44 AM
lclarke lclarke is offline
New User
 
Join Date: Dec 2011
Posts: 1
Default JSON Data compare

We are attempting to use BC to compare json formated data, and seem to be needing a blend of text compare and csv/data compare features.

I could use some pointers to how to coherce BC into matching up the pks (as it does for functions etc when comparing languages.

Three small sample records are pasted below. In this case mdl_pk is the key we'd like to align on.

Each record has a pk and we'd like BC to align the comparison by the pk.

If need be, we can inject a consistently named property to align on (eg RECORD_PK) and could probably arrange for it to be the first property in each record if that would help.

[
{
"mdl_auth_fk": "FA392775595B48C7A0198B3AFB83472D",
"mdl_id": "EP",
"mdl_instype_id": "ABC",
"mdl_order": 5,
"mdl_pk": "0236C75968424C2290DC5D295E86ABD4",
"mdl_prs_fk": "8973C2FEE6D34A8D9C7488AF31262EE6",
"mdl_systype": "XYZ",
"mdl_title": "This string could be quite long",
},
{
"mdl_auth_fk": "EE0D64533A134FDCA3B2746D4BE15377",
"mdl_id": "PD",
"mdl_instype_id": "ABC",
"mdl_order": 9,
"mdl_pk": "027C82A698FD4732A9E691C583CCC098",
"mdl_prs_fk": "8973C2FEE6D34A8D9C7488AF31262EE6",
"mdl_systype": "XYZ",
"mdl_title": "This string could be quite long",
"_mdl_pk_2009": 36
},
{
"mdl_auth_fk": "",
"mdl_id": "RPT",
"mdl_instype_id": "ABC",
"mdl_order": 10,
"mdl_pk": "06DAD869A9554E418AE426365BFFF775",
"mdl_prs_fk": "857D1F06BAE24BB3A3CE0D9DBE7DE890",
"mdl_systype": "XYZ",
"mdl_title": "This string could be quite long",
}
]
Reply With Quote
  #2  
Old 04-Jan-2012, 02:12 PM
Aaron Aaron is online now
Team Scooter
 
Join Date: Oct 2007
Location: Madison, WI
Posts: 7,293
Default

Hello,

The injection strategy may help when used in combination with an Important grammar and Never Align Differences.

Once injected, make a grammar element that matches on that key and define it as important. Then define all other grammars as unimportant and all other text as unimportant, and disable Ignore Unimportant Differences. This will still treat unimportant text as different (in a blue color). Then, in the Text Compare's Session Settings, Alignment tab, you can enable Never Align Differences (which applies to only Important text).

I would suggest testing this strategy with some test files created manually if the injection process is sufficiently complicated. Depending on your data, it may still not align as you expect if different blocks have different keys or if the keys are out of order. Both scenarios could cause the key to not align, but the block itself still would without the proper key alignment to "push" things into place.
__________________
Aaron P Scooter Software
Reply With Quote
Reply

Tags
data compare, json

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -6. The time now is 01:58 PM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.