vespina / json

100% VFP JSON parser & utilities
GNU General Public License v3.0
18 stars 6 forks source link

About Beautify returning null #6

Closed jhernancanom closed 1 year ago

jhernancanom commented 1 year ago

When useFastParser = .T. then Beautify returns null.

I tried the samples in ReadMe.

vespina commented 1 year ago

Check the latest version. First version that implemented fast parsing returned the original JS object, which can not be processed by Beautify method. Latest versions applied a normalization process so now the result obtained with normal parsing or fast parsing is exactly the same and can be beautified.

Check this test using last version;

DO JSON

?JSON.Beautify('{ "firstName" : "Victor", "lastName": "Espina", "YOB": 1970 }')

JSON.useFastParser = .T.

?JSON.Beautify('{ "firstName" : "Victor", "lastName": "Espina", "YOB": 1970 }')

JSON.NormalizeResults = .F.

?JSON.Beautify('{ "firstName" : "Victor", "lastName": "Espina", "YOB": 1970 }')

jhernancanom commented 1 year ago

Chévere, colega. Muchísimas gracias.

El mié, 7 dic 2022 a la(s) 09:02, Victor Espina escribió:

Check the latest version. First version that implemented fast parsing returned the original JS object, which can not be processed by Beautify method. Latest versions applied a normalization process so now the result obtained with normal parsing or fast parsing is exactly the same and can be beautified.

Check this test using last version;

DO JSON

?JSON.Beautify('{ "firstName" : "Victor", "lastName": "Espina", "YOB": 1970 }')

JSON.useFastParser = .T.

?JSON.Beautify('{ "firstName" : "Victor", "lastName": "Espina", "YOB": 1970 }')

JSON.NormalizeResults = .F.

?JSON.Beautify('{ "firstName" : "Victor", "lastName": "Espina", "YOB": 1970 }')

—Message ID: @.***>

jhernancanom commented 1 year ago

Hola, Víctor. Ejecuto en VFP9 y obtengo lo que hay en la primera imagen. OK. Ejecuto en VFPA-x64 y obtengo lo que hay en la segunda imagen.

Test.prg.txt

image

image

vespina commented 1 year ago

Hola Hernan. No habia visto este post. En el caso del fastparsing quizas el problema viene por el uso del componente VBScript desde un ambiente 64bits. Sin embargo, eso no explica porque no funciona el beautify con el parsing normal. Lamentablemente no trabajo con VFPA (aun) asi que no te sabria decir porque no funciona, pero lo tendre en cuenta para revisarlo en cuanto tenga oportunidad.