Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 6 of 6 total
Thread TDataSet LoadRows
Tue, Jul 4 2017 12:09 PMPermanent Link

Big Al

I have what I believe is a valid JSON dataset.

The contents are:
{"rows":[{"row":{"PersonID":"1"}}]}

I am wanting to load this into an ewb dataset.

I have create DataSet1.
If has a DataSetName of "rows" (I think this is correct)
a Name of DataSet1
and 1 column  named PersonID which is a dtInteger field
I then do the following in ewb:

DataSet1.Open;
DataSet1.LOadRows(Request.ResponseContent.Text);

Request.ResponseContent.text is set to the contents above.

When I execute the LoadRows, I get the following error:

Expected "}", instead found "PersonID" at 17
Line: 1

Does that mean that my JSON data is in a wrong format? I am using PHP to return the data and it looks like it's correct JSON data format.

Not sure what I'm doing wrong.

Thanks

Big Al
Tue, Jul 4 2017 12:14 PMPermanent Link

Matthew Jones

Big Al wrote:

> {"rows":[{"row":{"PersonID":"1"}}]}

https://jsonlint.com/ says it is valid format, so something more to it. Plenty of examples of the format have been posted to the forums, so have a search. Others have asked about this before, so the answer is here!

--

Matthew Jones
Tue, Jul 4 2017 12:23 PMPermanent Link

Walter Matte

Tactical Business Corporation

What is data definition of PersonID  - string or integer?
Tue, Jul 4 2017 12:24 PMPermanent Link

Walter Matte

Tactical Business Corporation

OK I see your original post is Integer - so no double quotes on the 1.
Tue, Jul 4 2017 12:36 PMPermanent Link

Raul

Team Elevate Team Elevate

On 7/4/2017 12:09 PM, Big Al wrote:
> I have what I believe is a valid JSON dataset.
>
> The contents are:
> {"rows":[{"row":{"PersonID":"1"}}]}

It's valid JSON but it's not  valid EWB Dataset JSON.

EWB JSON spec is defined here :

https://www.elevatesoft.com/manual?action=viewtopic&id=ewb2&topic=JSON_Reference

and says JSON is as follows :

{ rows: [ <Row>, <Row>, <Row>, ... ] }


so in your case it should be

{"rows":[{"PersonID":"1"}]}

Raul
Tue, Jul 4 2017 1:25 PMPermanent Link

Big Al

Thanks,
Since both ewb and what I was doing are valid JSON format, I just need to coax php into creating the format the way that EWB wants it.

Thanks everyone for your help. I will take it from here and see what I can do.

Big Al
Image