Cookies Settings

Loading

dnb-logo
Direct 2.0
Collapse

JSON Guidelines

D&B Direct REST responses are delivered as XML documents translated into JSON objects. The following list explains the conventions implemented by the D&B Direct API. Exception: The responses supplied by the Data Exchange Service follow the convention used by the respective business partner.

  • Attributes will always be represented by prefixing with “@”. (see Example 2)
  • If an element is repeatable, that element will be always returned as an Array of objects in the JSON response. (see Example 7)
    • If a repeatable element is not repeating in a specific JSON response, even then that element will be returned as an Array having a single object. (see Example 9)
  • Element content will be represented with “$” if it has attributes (see Example 2)
    • Consider a scenario where an element has an attribute as per the definition, however the attribute is not returned in a specific JSON response. Even then, the element content will be represented as “$” in the JSON. (see Example 4)
  • String values will be returned within double quotes. (see Example 14)
  • Numeric and Boolean values will not be returned within double quotes. (see Example 12 and Example 13)

Examples

#ScenarioXML InstanceJSON Instance
1Element having no attribute<DUNSNumber>804735132 </DUNSNumber>"DUNSNumber": "804735132"
2Element having Attribute<FamilyTreeMemberRoleText DNBCodeValue="12773">Parent </FamilyTreeMemberRoleText>"FamilyTreeMemberRoleText": { "@DNBCodeValue": 12773, "$": "Parent" }
3Aggregate having attribute<OrganizationIdentificationNumberDetail TypeText="Federal Taxpayer Identification Number (US)" DNBCodeValue="6863"> <OrganizationIdentificationNumber>12345 </OrganizationIdentificationNumber> </OrganizationIdentificationNumberDetail> "OrganizationIdentificationNumberDetail": { "@TypeText": "Federal Taxpayer Identification Number (US)", "@DNBCodeValue": 6863, "OrganizationIdentificationNumber": "12345" }
4Element having Attribute as per definition, however attribute is not returned for a specific JSON instance<OrganizationName>Gorman Manufacturing Company, Inc. </OrganizationName>"OrganizationName": { "$": "Gorman Manufacturing Company, Inc." }
5Aggregate having Attribute as per definition, however attribute is not returned for a specific JSON instance<OrganizationIdentificationNumberDetail > <OrganizationIdentificationNumber>12345 </OrganizationIdentificationNumber> </OrganizationIdentificationNumberDetail> "OrganizationIdentificationNumberDetail": { "OrganizationIdentificationNumber": "12345" }
6Non-Repeating Element<DUNSNumber>804735132 </DUNSNumber> "DUNSNumber": "804735132"
7Repeating Element<SalesRevenueAmount CurrencyISOAlpha3Code="USD”>1000000 </SalesRevenueAmount> <SalesRevenueAmount CurrencyISOAlpha3Code="CAD”>1040000 </SalesRevenueAmount> "SalesRevenueAmount": [ { "@CurrencyISOAlpha3Code": "USD", "$": 1000000 }, { "@CurrencyISOAlpha3Code": "CAD", "$": 1040000 } ]
8Repeating Aggregate<FamilyTreeMemberRole> <FamilyTreeMemberRoleText DNBCodeValue="12773">Parent </FamilyTreeMemberRoleText> </FamilyTreeMemberRole> <FamilyTreeMemberRole> <FamilyTreeMemberRoleText DNBCodeValue="12775">Global Ultimate </FamilyTreeMemberRoleText> </FamilyTreeMemberRole> <FamilyTreeMemberRole> <FamilyTreeMemberRoleText DNBCodeValue="12774">Domestic Ultimate </FamilyTreeMemberRoleText> </FamilyTreeMemberRole> "FamilyTreeMemberRole": [ {"FamilyTreeMemberRoleText": { "@DNBCodeValue": 12773, "$": "Parent" }}, {"FamilyTreeMemberRoleText": { "@DNBCodeValue": 12775, "$": "Global Ultimate" }}, {"FamilyTreeMemberRoleText": { "@DNBCodeValue": 12774, "$": "Domestic Ultimate" }} ]
9Element is repeatable as per the definition. However it is not repeating in a specific JSON instance.<SalesRevenueAmount CurrencyISOAlpha3Code="USD”>1000000 </SalesRevenueAmount>"SalesRevenueAmount": [ { "@CurrencyISOAlpha3Code": "USD", "$": 1000000 }]
10Aggregate is repeatable as per the definition. However it is not repeating in a specific JSON instance.<FamilyTreeMemberRole> <FamilyTreeMemberRoleText DNBCodeValue="12773">Parent </FamilyTreeMemberRoleText> </FamilyTreeMemberRole> "FamilyTreeMemberRole": [ {"FamilyTreeMemberRoleText": { "@DNBCodeValue": 12773, "$": "Parent" }} ]
11Date Field<TransactionTimestamp>2013-07-11T11:08:48.067-04:00 </TransactionTimestamp> "TransactionTimestamp": "2013-07-11T11:10:39.110-04:00"
12Boolean Field<StandaloneOrganizationIndicator>false </StandaloneOrganizationIndicator>"StandaloneOrganizationIndicator": false
13Numeric Field<RawScore>352</RawScore>"RawScore": 352
14String Field<LineText>492 Koller Street</LineText>"LineText": "492 Koller Street"