- changed status to resolved
Assert exception in parsed JSON assignment
Issue #154
resolved
Please try to execute the following code, which is formally correct:
var Oggetto:=JSON.NewObject;
Oggetto.Dati:=JSON.Parse('{"Campo":{"IDValue":5}}');
Oggetto.SottoOggetto:=Oggetto.Dati.Campo;
The last assignment will raise an exception of an Assert within the dwJSON.pas file.
The workaround to allow the code to work is as follows:
var Oggetto:=JSON.NewObject;
Oggetto.Dati:=JSON.Parse('{"Campo":{"IDValue":5}}');
Oggetto.SottoOggetto:=null; // Workaround!
Oggetto.SottoOggetto:=Oggetto.Dati.Campo;
As you can see, it was necessary to insert, before the last assignment, a completely useless pre assignment from a logical point of view.
In my opinion, this is a bug.
Comments (1)
-
repo owner - Log in to comment
Fixed issue
#154, JSON node re-parenting assignment + test→ <<cset 829ecef6d7be>>