cancel
Showing results for 
Search instead for 
Did you mean: 

WICED Studio Wi-Fi Combo

Anonymous
Not applicable

As I'm working with JSON parser, I noticed that everything works fine untile I receive a JSON frame with an object in it (I mean a child object). From the moment I receive such a JSON frame, all objects in the following frames are considered as children (even the root itself). After few investigations, I may have pointed out a bug in the JSON.c file, line 427 :

if ( parent_counter )

{

    parent_counter-- ;

    if ( parent_counter )

    {

        json_object.parent_object = &parent_json_object[ parent_counter - 1 ];

    }

    else

    {

        json_object.parent_object = &parent_json_object[ parent_counter ];

    }

}

In this part of the code, the parser determines the object's parent if it exists (parent_counter != 0) and affects its address to the json_object.parent_object pointer. But the problem is this pointer is never re-initialized (so all objects they will have a parent, even the root of the next JSON frame).

Here is how I solved this issue :

if ( parent_counter )

{

    parent_counter-- ;

    if ( parent_counter )

    {

        json_object.parent_object = &parent_json_object[ parent_counter - 1 ];

    }

    else

    {

        json_object.parent_object = &parent_json_object[ parent_counter ];

    }

} else {

    // NOTE : fix added by Romain

    json_object.parent_object = NULL;

}

I just wanted to expose this so you, so you can confirm this is a bug, and you can take it into consideration for next releases.

Regards

1 Reply
Moderator
Moderator

Thanks for the feedback romain

I went ahead a created a bug tracking request internally so that the SW team could review and consider this fix for the next release of the SDK.