Newer Version Available

This content describes an older version of this product. View Latest

Valid XML and JSON Records

A batch request in an XML or JSON file contains records for one object type. Each batch in an XML file uses this format, with each sObject tag representing a record.
1<?xml version="1.0" encoding="UTF-8"?>
2<sObjects xmlns="http://www.force.com/2009/06/asyncapi/dataload">
3   <sObject>
4      <field_name>field_value</field_name>
5      ...
6   </sObject>
7   <sObject>
8      <field_name>field_value</field_name>
9      ...
10   </sObject>
11</sObjects>

Each batch in a JSON file uses this format with each JSON object representing a record.

1[
2   {
3      "field_name" : "field_value"
4      ...
5   },
6   {
7      "field_name" : "field_value"
8      ...
9   }
10]

You must include the type field for a polymorphic field and exclude it for non-polymorphic fields in any batch. If you don’t the batch fails. A polymorphic field can refer to more than one type of object as a parent. For example, either a contact or a lead can be the parent of a task. In other words, the WhoId field of a task can contain the ID of either a contact or a lead.

Note

When generating records in XML or JSON files:

  • Fields that aren’t defined in the file for a record are ignored when you update records. To set a field value to null in XML, set the xsi:nil value for the field to true. For example, <description xsi:nil="true"/> sets the description field to null. Setting xsi:nil to false has no effect. If you define a field value and set xsi:nil to false, the value still gets assigned. To specify a null value in JSON, set the field value to null. For example, "description" : null.
  • Fields with a double data type can include fractional values. Values can be stored in scientific notation if the number is large enough (or, for negative numbers, small enough), as indicated by theW3C XML Schema Part 2: Datatypes Second Edition specification