'Character reference "&#” exception' error when trying to write JSON

Problem Description

When attempting to write JSON, the following exception is shown:

Character reference "&#” exception

 

Root Cause

The characters "&#" are together in the JSON, and that violates valid XML.

 

Solution

Locate the invalid XML syntax or XML characters and remove them from your input dataset before trying to write JSON.

 

To illustrate; use the following example XML input and push it through an XML validation tool, such as Validate an XML file. The results will show that the XML syntax is invalid.

 

Example XML input:

<breakfast_menu>
<food>
<name>Belgian Waffles</name>
<price>&#</price>
<description>
Two of our famous Belgian Waffles with plenty of real maple syrup
</description> 
<calories>650</calories> 
</food> 
<food>
<name>Strawberry Belgian Waffles</name>
<price>$7.95</price>
<description>
Light Belgian waffles covered with strawberries and whipped cream
</description>
<calories>900</calories>
</food>
<food>
<name>Berry-Berry Belgian Waffles</name>
<price>$8.95</price>
<description>
Light Belgian waffles covered with an assortment of fresh berries and whipped cream
</description>
<calories>900</calories>
</food>
<food>
<name>French Toast</name>
<price>$4.50</price>
<description>
Thick slices made from our homemade sourdough bread
</description>
<calories>600</calories>
</food>
<food>
<name>Homestyle Breakfast</name>
<price>$6.95</price>
<description>
Two eggs, bacon or sausage, toast, and our ever-popular hash browns
</description>
<calories>950</calories>
</food>
</breakfast_menu>
Version history
Revision #:
6 of 6
Last update:
‎06-25-2019 12:42 PM
Updated by:
 
Contributors