I am developing a web application in xojo 2021 release 1.1, I have a problem with json, the code works fine in xojo 2020 release 2.1., I can’t find a way to make it work.
Regards
var row_j As new JSONItem
row_j.Value(“empleado_codigo”) = txtCodigo.Value
row_j.Value(“nombres”) = txtNombres.Value
row_j.Value(“apellidos”) = txtApellidos.Value
row_j.Value(“cedula”) = txtCedula.Value
If dateNacimiento.Value = Nil Then
row_j.Value(“nacimiento_fecha”) = Nil
Unfortunately it can’t. Because each underlying object is a dictionary or array now instead of a custom object,
Here’s an example of the problem:
Var x as new JSONItem
x.child("people") = new JSONItem
Var y = x.child("people")
y.add(23)
When y is assigned on line 3, it is pointing to a Dictionary, because the creation of that object was just a JSONItem. When you call add on line 4, if we were to change the object into an array, the reference that says that it’s contained in x still points to the Dictionary that was created on line 1. You end up with y being an orphaned object which no longer affects or original structure.
Maybe the class should not have been changed, instead a new class like JSONObject could have been made the new way. The JSONItem is now broken and changed, result broken projects.