help-octave
[Top][All Lists]
Advanced

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

Re: Octave json creator


From: Przemek Klosowski
Subject: Re: Octave json creator
Date: Mon, 06 Dec 2010 16:45:04 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.12) Gecko/20101103 Fedora/1.0-0.33.b2pre.fc14 Lightning/1.0b2 Thunderbird/3.1.6

On 12/04/2010 05:38 AM, veryhappy wrote:

I'd created a function to turn octave data into a json object.
I would like to share it with you with the hope it will be useful to someone
else. I'd not exhaustively tested it but it should be fairly complete. It
should be able to compute structs, cells and multidimensional array keeping
the dimensions right.
If you have any suggestion or if it serve good for you, please, tell me.

Great idea but currently it doesn't handle cells. For example, a and b are a simple matrix and a cell, respectively:

a=[1 2 3 ; 4 5 6]
a =
   1   2   3
   4   5   6

b={[1 2 3],[ 4 5 6]}
b =
{
  [1,1] =
     1   2   3
  [1,2] =
     4   5   6
}

but they lead to the same JSON encoding:

object2json(a), object2json(b)
ans = [[1,2,3],[4,5,6]]
ans = [[1,2,3],[4,5,6]]

Actually, it occurred to me that save -text already covers all Octave
structures and is fairly close functionality, so perhaps it'd work better to add a JSON backend to it (e.g 'save -json'). What is your use case for JSON--do you expect it to be widely useful?


reply via email to

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