json response to ajax request

This forum is for general support of Xbase++
Post Reply
Message
Author
bwolfsohn
Posts: 648
Joined: Thu Jan 28, 2010 7:07 am
Location: Alachua, Florida USA
Contact:

json response to ajax request

#1 Post by bwolfsohn »

Does anyone have any functions to format an xbase/xb2net response in a json format ?
Brian Wolfsohn
Retired and traveling around the country to music festivals in my RV.
OOPS.. Corona Virus, so NOT traveling right now...
http://www.breadmanrises.com
FB travel group: The Breadman Rises

patito
Posts: 121
Joined: Tue Aug 31, 2010 9:01 pm

Re: json response to ajax request

#2 Post 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

User avatar
Tom
Posts: 1171
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: json response to ajax request

#3 Post 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.
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

bwolfsohn
Posts: 648
Joined: Thu Jan 28, 2010 7:07 am
Location: Alachua, Florida USA
Contact:

Re: json response to ajax request

#4 Post 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..
Brian Wolfsohn
Retired and traveling around the country to music festivals in my RV.
OOPS.. Corona Virus, so NOT traveling right now...
http://www.breadmanrises.com
FB travel group: The Breadman Rises

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: json response to ajax request

#5 Post 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
The eXpress train is coming - and it has more cars.

bwolfsohn
Posts: 648
Joined: Thu Jan 28, 2010 7:07 am
Location: Alachua, Florida USA
Contact:

Re: json response to ajax request

#6 Post 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:
Brian Wolfsohn
Retired and traveling around the country to music festivals in my RV.
OOPS.. Corona Virus, so NOT traveling right now...
http://www.breadmanrises.com
FB travel group: The Breadman Rises

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: json response to ajax request

#7 Post by rdonnay »

so, any dc_json_in() and dc_json_out() functions yet ??
:angry-screaming:
The eXpress train is coming - and it has more cars.

bwolfsohn
Posts: 648
Joined: Thu Jan 28, 2010 7:07 am
Location: Alachua, Florida USA
Contact:

Re: json response to ajax request

#8 Post 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:
Brian Wolfsohn
Retired and traveling around the country to music festivals in my RV.
OOPS.. Corona Virus, so NOT traveling right now...
http://www.breadmanrises.com
FB travel group: The Breadman Rises

Post Reply