DXA 2 promises to publish less verbose JSON, sending smaller JSON items into the Publishing Queue and therefore speeding up our publish times. It will also consume less space in the Broker DB. So they say! But, what does the new and old JSON look like and is it much lighter? In this article I’ll highlight only the diffs between the rendering of a Keyword field JSON and Textfield JSON. And, you might be wondering why I even care (aside from curiosity), but I’ve built a TBB that amends the Published DXA JSON and injects Structure Group Metadata fields masquerading as Page Metadata fields (in the JSON) and therefore available to our DXA Frontend WebApp. OK, so here it is:
DXA 1.7 Keyword Field
"people": { "Name": "people", "Values": [ "Public and Member Communications", "Public Interest people", "Publications and Databases" ], "NumericValues": [ ], "DateTimeValues": [ ], "LinkedComponentValues": [ ], "FieldType": 3, "CategoryName": "people List", "CategoryId": "tcm:11-11393-512", "XPath": "Metadata/custom:people", "KeywordValues": [ { "IsRoot": false, "IsAbstract": false, "Description": "", "Key": "", "TaxonomyId": "tcm:11-11393-512", "Path": "\\people List\\Public and Member Communications", "RelatedKeywords": [ ], "ParentKeywords": [ ], "MetadataFields": { }, "Id": "tcm:11-106852-1024", "Title": "Public and Member Communications" }, { "IsRoot": false, "IsAbstract": false, "Description": "", "Key": "", "TaxonomyId": "tcm:11-11393-512", "Path": "\\people List\\Public Interest people", "RelatedKeywords": [ ], "ParentKeywords": [ ], "MetadataFields": { }, "Id": "tcm:11-106848-1024", "Title": "Public Interest people" }, { "IsRoot": false, "IsAbstract": false, "Description": "", "Key": "", "TaxonomyId": "tcm:11-11393-512", "Path": "\\people List\\Publications and Databases", "RelatedKeywords": [ ], "ParentKeywords": [ ], "MetadataFields": { }, "Id": "tcm:11-106853-1024", "Title": "Publications and Databases" } ] }
DXA 2.0 Keyword Field
"people": { "$type": "KeywordModelData[]", "$values": [ { "Id": "106852" }, { "Id": "106848" }, { "Id": "106853" } ] },
DXA 1.7 Text Field
"language": { "Name": "language", "Values": [ "English" ], "NumericValues": [ ], "DateTimeValues": [ ], "LinkedComponentValues": [ ], "FieldType": 0, "XPath": "Metadata/custom:language", "KeywordValues": [ ] },
DXA 2.0 Text Field
"language": "English",
Summary
So, there we have it, the new DXA 2.0 JSON delivers what it promises – much leaner and meaner JSON for the benefit of us all.