octave-patch-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-patch-tracker] [patch #9980] JSON encoder and decoder, alternati


From: Philip Nienhuis
Subject: [Octave-patch-tracker] [patch #9980] JSON encoder and decoder, alternative to object2json
Date: Sat, 17 Oct 2020 17:04:58 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 6.1; rv:52.0) Gecko/20100101 Firefox/52.0

Follow-up Comment #6, patch #9980 (project octave):

@Ketan:

Input validation:

fromJSON:
=========
0 checking that there is input at all (nargin >= 1)
0 checking that input *is* a character string
0 ditto that is has sufficient minimum length (how'd you parse ""? or is that
accepted and if yes, what class output would I get, a double? char?)

If parsing fails, can fromJSON indicate at what character position it lost
track? (is this useful? is it a nice to have? - I'm unfamiliar with JSON so
I'm not afraid to ask stupid questions)

BIST for input validation look like this:
%!error fromJSON (true) <here your error message between angular brackets>
I core Octave you can find many .m-file functions with examples.

toJSON:
=======
0 does it accept classdef objects? Java objects? COM objects? empty objects?
0 what if PREC is a struct?
0 same for JSON?

What does the code at L.63 actually do?

isbool(PREC) && ([PREC,JSON] = {[],PREC}{})


Assigment happens to [PREC,JSON] but the rest? IMO this is unneededly
convoluted code. I tried several values and classes for PREC and JSON and
consistently got 0 (obviously) that is assigned to nothing.

At the bottom of both functions there's "scraps" that don't belong there.
Should either be before the tests or deleted.

Version tracking:
"help version"
"help compare_versions"

Does toJSoN produce "sufficiently compatible" output for "regular" input, that
can be read by e.g., jsondecode? (or any other JSON parser Out There? Matlab?
we aim at Matlab compatbility)
I've read and understand your musings in comment #3 so please a short answer
:-)


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/patch/?9980>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]