XML to JSON policy deployment error troubleshooting

You're viewing Apigee and Apigee hybrid documentation.
View Apigee Edge documentation.

EitherOptionOrFormat

Error message

Deployment of the API proxy through either the Apigee UI or API fails with this error message:

ErrorSavingRevision[revision_number]
XMLToJSON[{0}]:EitherOptionsorFormatmustbespecified.

Example error

Error Saving Revision 1
XMLToJSON[{0}]: Either Options or Format must be specified.

Example screenshot

Either options or format must be specified error message.

Cause

If one of the elements <Options> or <Format> is not declared in the XML to JSON Policy, then the deployment of the API proxy fails.

<Options> is required if <Format> isn't used.

Use either the <Format> element or <Options> element group. You cannot use both <Format> and <Options>. Predefined formats include: xml.com, yahoo, google, and badgerFish.

Diagnosis

  1. Examine all the XML to JSON policies in the specific API proxy where the failure has occurred. If there is any XML to JSON policy in which either of the elements <Options> or <Format> is not declared, then that's the cause of the error.

    For example, the following policy does not have either of the elements declared:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <XMLToJSON async="false" continueOnError="false" enabled="true" name="XMLToJSON">
     <DisplayName>XMLToJSON</DisplayName>
     <Properties/>
     <OutputVariable>response</OutputVariable>
     <Source>response</Source>
    </XMLToJSON>
    

Resolution

Ensure that the XML of the XML to JSON policy has one of the elements <Options> or <Format> declared in the policy.

Example 1:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<XMLToJSON async="false" continueOnError="false" enabled="true" name="XMLToJSON">
 <DisplayName>XMLToJSON</DisplayName>
 <Properties/>
 <Format>google</Format>
 <OutputVariable>response</OutputVariable>
 <Source>response</Source>
</XMLToJSON>

Example 2:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<XMLToJSON async="false" continueOnError="false" enabled="true" name="XMLToJSON">
 <DisplayName>XMLToJSON</DisplayName>
 <Properties/>
 <Options>
 <RecognizeNumber>true</RecognizeNumber>
 <RecognizeBoolean>true</RecognizeBoolean>
 <RecognizeNull>true</RecognizeNull>
 </Options>
 <OutputVariable>response</OutputVariable>
 <Source>response</Source>
</XMLToJSON>

UnknownFormat

Error message

Deployment of the API proxy through either the Apigee UI or API fails with this error message:

ErrorSavingRevision[revision_number]
XMLToJSON[policy_name]:UnknownFormat[unknown_format].

Example error

ErrorSavingRevision1
XMLToJSON[WithFormat]:UnknownFormatgoogle.com.

Example screenshot

Unknown format error message.

Cause

If the <Format> element within the XML to JSON policy has an unknown format defined, then the deployment of the API proxy fails.

Predefined formats include: xml.com, yahoo, google, and badgerFish.

Diagnosis

  1. Identify the XML to JSON policy where the error occurred and the unknown format. You can find this information from the error message. For example, in the following error, the policy name is WithFormat and the unknown format is google.com:

    ErrorSavingRevision1
    XMLToJSON[WithFormat]:UnknownFormatgoogle.com.
    
  2. Verify that the unknown format specified in the failed XML to JSON policy matches with the value identified in the error message (step #1 above). For example, the following policy specifies the format as google.com, which matches what's in the error message:

    <XMLToJSON async="false" continueOnError="false" enabled="true" name="WithFormat">
     <DisplayName>WithFormat</DisplayName>
     <Properties/>
     <Format>google.com</Format>
     <OutputVariable>response</OutputVariable>
     <Source>response</Source>
    </XMLToJSON>
    
  3. If the Format specified is not one among the predefined formats xml.com, yahoo, google, or badgerFish, then that's the cause of the error.

    In the example XML to JSON Policy shown above, the format is google.com which is invalid. Therefore, the deployment of the API Proxy fails with the error:

    XMLToJSON[WithFormat]:UnknownFormatgoogle.com.
    

Resolution

Ensure that the format specified in the <Format> element of the XML to JSON policy is valid. For example:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<XMLToJSON async="false" continueOnError="false" enabled="true" name="WithFormat">
 <DisplayName>WithFormat</DisplayName>
 <Properties/>
 <Format>google</Format>
 <OutputVariable>response</OutputVariable>
 <Source>response</Source>
</XMLToJSON>

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年11月24日 UTC.