Page 1 of 1

json response to ajax request

Posted: Wed Jul 10, 2013 1:33 pm
by bwolfsohn
Does anyone have any functions to format an xbase/xb2net response in a json format ?

Re: json response to ajax request

Posted: Thu Jul 11, 2013 8:09 pm
by patito
hI

Subject JSON CONTAINER Class
From Pablo Botella
Date Tue, 27 Mar 2012 12:15:42 -0600
Newsgroups ot4xb.examples
Attachment(s) JSON_CONTAINER.zip
news.xbwin.com/ot4xb.examples

http://www.xbwin.com/forum.html
Best regard
Hector

Re: json response to ajax request

Posted: Fri Jul 12, 2013 6:04 am
by Tom
JSON is quite simple - it's almost an array, similar to the ones we have in Xbase++. Take a look here:

http://en.wikipedia.org/wiki/Json

If you just want to create a data response, it should be not more than 10 lines of code to format a JSON array.

Re: json response to ajax request

Posted: Fri Jul 12, 2013 8:13 am
by bwolfsohn
Hector, Tom, thanks for the info...

Tom, i'll try to implement your approach, as i hate to add libraries if i don't absolutely need to...

ot4xb has some great stuff, i just haven't needed to use it yet..

Re: json response to ajax request

Posted: Fri Jul 12, 2013 11:08 am
by rdonnay
Brian -

Bobby and I have had to convert code recently to read .JSON because the City of NY changed their procedures.

It's a text-readable format that is not difficult to convert to any format you need.

We found out later, however, that the NYC Open Data system, even though it was based on JSON, we could still request the data in CSV format. It was just a small change in the URL.

Roger

Re: json response to ajax request

Posted: Fri Jul 12, 2013 11:28 am
by bwolfsohn
rdonnay wrote:Brian -

Bobby and I have had to convert code recently to read .JSON because the City of NY changed their procedures.

It's a text-readable format that is not difficult to convert to any format you need.

We found out later, however, that the NYC Open Data system, even though it was based on JSON, we could still request the data in CSV format. It was just a small change in the URL.
Roger,

This is strictly for internal use... We're trying to implement ajax (again) for our online. i passed on previous developers asking for json requests, but it's much easier for them (doing javascript) if i can give them json.

so, any dc_json_in() and dc_json_out() functions yet ?? :think: :think:

Re: json response to ajax request

Posted: Fri Jul 12, 2013 12:05 pm
by rdonnay
so, any dc_json_in() and dc_json_out() functions yet ??
:angry-screaming:

Re: json response to ajax request

Posted: Fri Jul 12, 2013 12:43 pm
by bwolfsohn
rdonnay wrote:
so, any dc_json_in() and dc_json_out() functions yet ??
:angry-screaming:
I thought that would get a rise outta ya.. :clap: :clap:

It couldn't have come as a shock.. : :lol: