Hi, I am heavy user of json files and LIBJSON Class ( from SSC) is my first choice to tackle it.
However, when include it in a loop, I get an error. I was not even able to close the loop bracket.
In a conditional, I had to include another "}" to move on
any clue? thanks, in advance
Code:
: scv[1,1]=`"{"title":"Title","data":"Data","foo": "Bar1"}"'
: scv[2,1]=`"{"title":"Title","data":"Data","foo": "Bar2"}"'
: scv
1
+-------------------------------------------------+
1 | {"title":"Title","data":"Data","foo": "Bar1"} |
2 | {"title":"Title","data":"Data","foo": "Bar2"} |
+-------------------------------------------------+
: a=libjson()
: root=a.parse(scv[1])
: root->getString(("foo"),"")
Bar1
Code:
: for (i=1; i<=rows(scv); i++){
> root=a.parse(scv[i])
> if (root) { // continues if pointer value (root) that does not “points to nothing”
> root->getString(("foo"),"");
type mismatch: -> (pointing to): transmorphic found where pointer expected
r(3000);
Code:
: if (root) {
> root->getString(("foo"),"")
> }
> }
Bar1
expression invalid
r(3000);
any clue? thanks, in advance

Comment