<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Issue with &amp;quot;cJSON_Parse failed :&amp;quot; in lte_ble_gateway application</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/63308/issue-with-cjson_parse-failed-in-lte_ble_gateway-application</link><description>Hi Team, 
 
 We are working on the nRF9160 DK. We are integrating the central_uart code into the lte_ble_gateway, As we integrated for the purpose to use NUS(nordic uart service). As the project is compiled successfully, But at run time i observed the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 06 Jul 2020 13:46:47 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/63308/issue-with-cjson_parse-failed-in-lte_ble_gateway-application" /><item><title>RE: Issue with "cJSON_Parse failed :" in lte_ble_gateway application</title><link>https://devzone.nordicsemi.com/thread/258623?ContentTypeID=1</link><pubDate>Mon, 06 Jul 2020 13:46:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a9ec0ae5-ba83-4e61-9bfe-f9540bc7becb</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;Could you debug your application and look at the function&amp;nbsp;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;cJSON_Parse() (&lt;em&gt;&amp;lt;..&amp;gt;\ncs\v1.3.0\nrf\subsys\net\lib\nrf_cloud\src\nrf_cloud_codec.c&lt;/em&gt;)
&lt;ul&gt;
&lt;li&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;→&lt;strong&gt;cJSON_ParseWithOpts()&lt;/strong&gt; (&lt;em&gt;&amp;lt;..&amp;gt;\ncs\v1.3.0\nrf\ext\cjson\cJSON.c&lt;/em&gt;):&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;CJSON_PUBLIC(cJSON *) cJSON_ParseWithOpts(const char *value, const char **return_parse_end, cJSON_bool require_null_terminated)
{
    parse_buffer buffer = { 0, 0, 0, 0, { 0, 0, 0 } };
    cJSON *item = NULL;

    /* reset error position */
    global_error.json = NULL;
    global_error.position = 0;

    if (value == NULL)
    {
        goto fail;
    }

    buffer.content = (const unsigned char*)value;
    buffer.length = strlen((const char*)value) + sizeof(&amp;quot;&amp;quot;);
    buffer.offset = 0;
    buffer.hooks = global_hooks;

    item = cJSON_New_Item(&amp;amp;global_hooks);
    if (item == NULL) /* memory fail */
    {
        goto fail;
    }

    if (!parse_value(item, buffer_skip_whitespace(skip_utf8_bom(&amp;amp;buffer))))
    {
        /* parse failure. ep is set. */
        goto fail;
    }

    /* if we require null-terminated JSON without appended garbage, skip and then check for a null terminator */
    if (require_null_terminated)
    {
        buffer_skip_whitespace(&amp;amp;buffer);
        if ((buffer.offset &amp;gt;= buffer.length) || buffer_at_offset(&amp;amp;buffer)[0] != &amp;#39;\0&amp;#39;)
        {
            goto fail;
        }
    }
    if (return_parse_end)
    {
        *return_parse_end = (const char*)buffer_at_offset(&amp;amp;buffer);
    }

    return item;

fail:
    if (item != NULL)
    {
        cJSON_Delete(item);
    }

    if (value != NULL)
    {
        error local_error;
        local_error.json = (const unsigned char*)value;
        local_error.position = 0;

        if (buffer.offset &amp;lt; buffer.length)
        {
            local_error.position = buffer.offset;
        }
        else if (buffer.length &amp;gt; 0)
        {
            local_error.position = buffer.length - 1;
        }

        if (return_parse_end != NULL)
        {
            *return_parse_end = (const char*)local_error.json + local_error.position;
        }

        global_error = local_error;
    }

    return NULL;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Put breakpoints on all &lt;em&gt;&amp;quot;goto&amp;nbsp;fail&amp;quot;&amp;nbsp;&lt;/em&gt;to see where the error comes from.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with "cJSON_Parse failed :" in lte_ble_gateway application</title><link>https://devzone.nordicsemi.com/thread/258235?ContentTypeID=1</link><pubDate>Fri, 03 Jul 2020 07:26:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cbf4281e-2297-4274-9957-bf87719fc000</guid><dc:creator>Turbo J</dc:creator><description>&lt;p&gt;Thanks, I miscounted { } above. Unfortunately that also means I have absolutely zero idea why the JSON parse step failed. :-(&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with "cJSON_Parse failed :" in lte_ble_gateway application</title><link>https://devzone.nordicsemi.com/thread/258219?ContentTypeID=1</link><pubDate>Fri, 03 Jul 2020 05:15:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b418d52f-b293-4d73-900c-d63647911f9e</guid><dc:creator>venkatesh dyagala</dc:creator><description>&lt;pre class="aLF-aPX-K0-aPE"&gt;Hi,&lt;br /&gt;&lt;br /&gt;Please find the text as requested&lt;br /&gt;&lt;br /&gt;cJSON_Parse failed: {&amp;quot;desired&amp;quot;:{&amp;quot;pairing&amp;quot;:{&amp;quot;state&amp;quot;:&amp;quot;paired&amp;quot;,&amp;quot;topics&amp;quot;:{&amp;quot;d2c&amp;quot;:&amp;quot;prod/05f78b98-f918-44bb-b4ce-f55604c81c6d/m/d/nrf-352656100373185/d2c&amp;quot;,&amp;quot;c2d&amp;quot;:&amp;quot;prod/05f78b98-f918-44bb-b4ce-f55604c81c6d/m/d/nrf-352656100373185/c2d&amp;quot;}},&amp;quot;nrfcloud_mqtt_topic_prefix&amp;quot;:&amp;quot;prod/05f78b98-f918-44bb-b4ce-f55604c81c6d/&amp;quot;},&amp;quot;config&amp;quot;:{&amp;quot;GPS&amp;quot;:{&amp;quot;enable&amp;quot;:false}}}\x0D\x0A
2020-07-02T10:08:28.471Z DEBUG modem &amp;lt;&amp;lt; E: nrf_cloud_decode_requested_state Failed -2\x0D\x0A
2020-07-02T10:08:28.475Z DEBUG modem &amp;lt;&amp;lt; E: Handler failed! state: 5, type: 3\x0D\x0A
2020-07-02T10:08:28.530Z DEBUG modem &amp;lt;&amp;lt; E: nct_input: failed -2\x0D\x0A&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Thanks,&lt;br /&gt;venkatesh&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with "cJSON_Parse failed :" in lte_ble_gateway application</title><link>https://devzone.nordicsemi.com/thread/258084?ContentTypeID=1</link><pubDate>Thu, 02 Jul 2020 11:45:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:32f51530-3a52-4f59-b35f-e54a83f9bcba</guid><dc:creator>Turbo J</dc:creator><description>&lt;p&gt;Pretty sure there is a missing &amp;quot;}&amp;quot; in the JSON. Please copy and paste AS TEXT and not as image.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>