Hi,
Someone has to implement json function of harbour project ?
http://harbour-project.svn.sourceforge.net/viewvc/harbour-project/trunk/harbour/src/rtl/hbjson.c
It's possible to translate?
Thank you.
Pere
|
|
0
|
|
|
|
Reply
|
pcordo
|
2/23/2011 11:49:03 AM |
|
Dear pcordo:
On Feb 23, 4:49=A0am, pcordo <perecordo...@gmail.com> wrote:
>
> Someone has to implement json function of harbour project ?
>
> It's possible to translate?
Should be able to implement with minimal effort, since c code is
available:
http://www.json.org/
I see serious collisions between the simple character mapping of
(x)Harbour and UNICODE, but other than that, it looks like reading-
in / writing-out a flat file with no indexing scheme.
David A. Smith
|
|
0
|
|
|
|
Reply
|
dlzc
|
2/23/2011 1:53:52 PM
|
|
On 23 Feb, 14:53, dlzc <dl...@cox.net> wrote:
> Dear pcordo:
>
> On Feb 23, 4:49=A0am, pcordo <perecordo...@gmail.com> wrote:
>
>
>
> > Someone has to implement json function of harbour project ?
>
> > It's possible to translate?
>
> Should be able to implement with minimal effort, since c code is
> available:http://www.json.org/
>
> I see serious collisions between the simple character mapping of
> (x)Harbour and UNICODE, but other than that, it looks like reading-
> in / writing-out a flat file with no indexing scheme.
>
> David A. Smith
Dear David,
I have no knowledge of c, there would be someone who is disposed to
help me?
or show me the way to call these functions?
Thank you so much
Pere
|
|
0
|
|
|
|
Reply
|
pcordo
|
2/23/2011 2:19:35 PM
|
|
Dear pcordo:
On Feb 23, 7:19=A0am, pcordo <perecordo...@gmail.com> wrote:
> On 23 Feb, 14:53, dlzc <dl...@cox.net> wrote:
> > On Feb 23, 4:49=A0am, pcordo <perecordo...@gmail.com> wrote:
>
> > > Someone has to implement json function of
> > > harbour project ?
>
> > > It's possible to translate?
>
> > Should be able to implement with minimal effort,
> > since c code is available:
http://www.json.org/
>
> > I see serious collisions between the simple character
> > mapping of (x)Harbour and UNICODE, but other than
> > that, it looks like reading- n / writing-out a flat file with
> > no indexing scheme.
>
> I have no knowledge of c, there would be someone who
> is disposed to help me? or show me the way to call
> these functions?
You can search this newsgroup for instances of "#pragma", to see how C
code is embedded in our (x)Harbour code. Doesn't mean you won't need
help besides this.
You should start with the C function list, and enumerate the
"goesintas" (goes in to's) and "comesoutas". That way you'd know what
parameters to pass, what "publics" need to be set (hopefully few to
none), what values to get back, and what errors look like.
Then the ugliness begins.
David A. Smith
|
|
0
|
|
|
|
Reply
|
dlzc
|
2/23/2011 6:15:49 PM
|
|
Hi Pere,
What is this function actually doing? Could you give an example?
If it is worth, then we could include it in xHarbour.
Andi
On Wed, 23 Feb 2011 03:49:03 -0800 (PST), pcordo
<perecordonet@gmail.com> wrote:
>Hi,
>
>Someone has to implement json function of harbour project ?
>
>http://harbour-project.svn.sourceforge.net/viewvc/harbour-project/trunk/harbour/src/rtl/hbjson.c
>
>It's possible to translate?
>
>Thank you.
>Pere
|
|
0
|
|
|
|
Reply
|
xharbour_delete
|
2/23/2011 11:30:19 PM
|
|
Dear Andi Jahja:
On Feb 23, 4:30=A0pm, xharbour_del...@telkom.net.id (Andi Jahja) wrote:
>
> What is this function actually doing? Could you give
> an example? If it is worth, then we could include it
> in xHarbour.
It is like an open source "spreadsheet" of sorts, or limited XML
table. So it'd need an RDD wrapper to fit into the language
transparently. The source code is open, presumably, and in C... so a
LIB or DLL might be possible, but pretty difficult to reconcile unless
an RDD were formed.
From arm's length...
David A. Smith
|
|
0
|
|
|
|
Reply
|
dlzc
|
2/24/2011 2:34:12 AM
|
|
Dear David:
Thanks for info. Sorry, I still don't get it. :(
Unless there is a sample code for me to see with my old eyes what the
function is really doing...
I am pretty dumb in understanding narative description :(
Andi
On Wed, 23 Feb 2011 18:34:12 -0800 (PST), dlzc <dlzc1@cox.net> wrote:
>Dear Andi Jahja:
>
>On Feb 23, 4:30�pm, xharbour_del...@telkom.net.id (Andi Jahja) wrote:
>>
>> What is this function actually doing? Could you give
>> an example? If it is worth, then we could include it
>> in xHarbour.
>
>It is like an open source "spreadsheet" of sorts, or limited XML
>table. So it'd need an RDD wrapper to fit into the language
>transparently. The source code is open, presumably, and in C... so a
>LIB or DLL might be possible, but pretty difficult to reconcile unless
>an RDD were formed.
>
>From arm's length...
>
>David A. Smith
|
|
0
|
|
|
|
Reply
|
xharbour_delete
|
2/24/2011 2:57:22 AM
|
|
On Wed, 23 Feb 2011 18:34:12 -0800 (PST), dlzc <dlzc1@cox.net> wrote:
>Dear Andi Jahja:
>
>On Feb 23, 4:30�pm, xharbour_del...@telkom.net.id (Andi Jahja) wrote:
>>
>> What is this function actually doing? Could you give
>> an example? If it is worth, then we could include it
>> in xHarbour.
>
>It is like an open source "spreadsheet" of sorts, or limited XML
>table. So it'd need an RDD wrapper to fit into the language
>transparently. The source code is open, presumably, and in C... so a
>LIB or DLL might be possible, but pretty difficult to reconcile unless
>an RDD were formed.
>
>From arm's length...
>
>David A. Smith
Dear David:
Ah, OK I got three minutes learning about json as suggested by one
site and I think I already have a picture of what json is now. I saw a
sample how a portion of grid, complete with its accesorial menus can
be displayed on a website via json output. Very much interesting!
Will try my best to make xHarbour interface to json functions this
weekend. :)
Andi
|
|
0
|
|
|
|
Reply
|
xharbour_delete
|
2/24/2011 7:45:31 AM
|
|
On 24 Feb, 03:57, xharbour_del...@telkom.net.id (Andi Jahja) wrote:
> Dear David:
>
> Thanks for info. Sorry, I still don't get it. :(
> Unless there is a sample code for me to see with my old eyes what the
> function is really doing...
>
> I am pretty dumb in understanding narative description :(
>
> Andi
>
>
>
>
>
>
>
> On Wed, 23 Feb 2011 18:34:12 -0800 (PST), dlzc <dl...@cox.net> wrote:
> >Dear Andi Jahja:
>
> >On Feb 23, 4:30=A0pm, xharbour_del...@telkom.net.id (Andi Jahja) wrote:
>
> >> What is this function actually doing? Could you give
> >> an example? =A0If it is worth, then we could include it
> >> in xHarbour.
>
> >It is like an open source "spreadsheet" of sorts, or limited XML
> >table. =A0So it'd need an RDD wrapper to fit into the language
> >transparently. =A0The source code is open, presumably, and in C... so a
> >LIB or DLL might be possible, but pretty difficult to reconcile unless
> >an RDD were formed.
>
> >From arm's length...
>
> >David A. Smith
Hi Andi,
I try integrate my program with a web application through rest api.
The response of rest call is a json code.
Ex:
{
"data":
{
"edition": "Community",
"version": "3.4.0 (d 3370)",
"schema": "4113"
}
}=1A
I think, it's more easy adapt harbour code to xharbour. Can you adapt
t'his code ?
I think, it's more easy adapt harbour code to xharbour. Can you adapt
this code ? or we have a problem with licences.
Thank you Andi
Pere
|
|
0
|
|
|
|
Reply
|
pcordo
|
2/24/2011 7:47:35 AM
|
|
On Wed, 23 Feb 2011 23:47:35 -0800 (PST), pcordo
<perecordonet@gmail.com> wrote:
>On 24 Feb, 03:57, xharbour_del...@telkom.net.id (Andi Jahja) wrote:
>> Dear David:
>>
>> Thanks for info. Sorry, I still don't get it. :(
>> Unless there is a sample code for me to see with my old eyes what the
>> function is really doing...
>>
>> I am pretty dumb in understanding narative description :(
>>
>> Andi
>>
>>
>>
>>
>>
>>
>>
>> On Wed, 23 Feb 2011 18:34:12 -0800 (PST), dlzc <dl...@cox.net> wrote:
>> >Dear Andi Jahja:
>>
>> >On Feb 23, 4:30�pm, xharbour_del...@telkom.net.id (Andi Jahja) wrote:
>>
>> >> What is this function actually doing? Could you give
>> >> an example? �If it is worth, then we could include it
>> >> in xHarbour.
>>
>> >It is like an open source "spreadsheet" of sorts, or limited XML
>> >table. �So it'd need an RDD wrapper to fit into the language
>> >transparently. �The source code is open, presumably, and in C... so a
>> >LIB or DLL might be possible, but pretty difficult to reconcile unless
>> >an RDD were formed.
>>
>> >From arm's length...
>>
>> >David A. Smith
>
>Hi Andi,
>
>I try integrate my program with a web application through rest api.
>
>The response of rest call is a json code.
>Ex:
>{
> "data":
> {
> "edition": "Community",
> "version": "3.4.0 (d 3370)",
> "schema": "4113"
> }
>}
>
>I think, it's more easy adapt harbour code to xharbour. Can you adapt
>t'his code ?
>
>I think, it's more easy adapt harbour code to xharbour. Can you adapt
>this code ? or we have a problem with licences.
>
>Thank you Andi
>Pere
Hi Pere:
Yes, it is much easier of course. We don't have to reinvent a wheel.
Let me work on it this week end too :)
Andi
|
|
0
|
|
|
|
Reply
|
xharbour_delete
|
2/24/2011 7:50:27 AM
|
|
On 24 Feb, 08:50, xharbour_del...@telkom.net.id (Andi Jahja) wrote:
> On Wed, 23 Feb 2011 23:47:35 -0800 (PST), pcordo
>
>
>
>
>
>
>
>
>
> <perecordo...@gmail.com> wrote:
> >On 24 Feb, 03:57, xharbour_del...@telkom.net.id (Andi Jahja) wrote:
> >> Dear David:
>
> >> Thanks for info. Sorry, I still don't get it. :(
> >> Unless there is a sample code for me to see with my old eyes what the
> >> function is really doing...
>
> >> I am pretty dumb in understanding narative description :(
>
> >> Andi
>
> >> On Wed, 23 Feb 2011 18:34:12 -0800 (PST), dlzc <dl...@cox.net> wrote:
> >> >Dear Andi Jahja:
>
> >> >On Feb 23, 4:30 pm, xharbour_del...@telkom.net.id (Andi Jahja) wrote:
>
> >> >> What is this function actually doing? Could you give
> >> >> an example? If it is worth, then we could include it
> >> >> in xHarbour.
>
> >> >It is like an open source "spreadsheet" of sorts, or limited XML
> >> >table. So it'd need an RDD wrapper to fit into the language
> >> >transparently. The source code is open, presumably, and in C... so a
> >> >LIB or DLL might be possible, but pretty difficult to reconcile unles=
s
> >> >an RDD were formed.
>
> >> >From arm's length...
>
> >> >David A. Smith
>
> >Hi Andi,
>
> >I try integrate my program with a web application through rest api.
>
> >The response of rest call is a json code.
> >Ex:
> >{
> > =A0 "data":
> > =A0 {
> > =A0 =A0 =A0"edition": "Community",
> > =A0 =A0 =A0"version": "3.4.0 (d 3370)",
> > =A0 =A0 =A0"schema": "4113"
> > =A0 }
> >}
>
> >I think, it's more easy adapt harbour code to xharbour. Can you adapt
> >t'his code ?
>
> >I think, it's more easy adapt harbour code to xharbour. Can you adapt
> >this code ? or we have a problem with licences.
>
> >Thank you Andi
> >Pere
>
> Hi Pere:
>
> Yes, it is much easier of course. We don't have to reinvent a wheel.
> Let me work on it this week end too :)
>
> Andi
I will be sparse impatient ...
Pere
|
|
0
|
|
|
|
Reply
|
pcordo
|
2/24/2011 8:40:05 AM
|
|
Dear Andi Jahja:
On Feb 24, 12:45=A0am, xharbour_del...@telkom.net.id (Andi Jahja) wrote:
> On Wed, 23 Feb 2011 18:34:12 -0800 (PST), dlzc <dl...@cox.net> wrote:
> >On Feb 23, 4:30 pm, xharbour_del...@telkom.net.id (Andi Jahja) wrote:
>
> >> What is this function actually doing? Could you give
> >> an example? =A0If it is worth, then we could include it
> >> in xHarbour.
>
> >It is like an open source "spreadsheet" of sorts, or
> >limited XML table. =A0So it'd need an RDD wrapper to fit
> >into the language transparently. =A0The source code is
> >open, presumably, and in C... so a LIB or DLL might
> >be possible, but pretty difficult to reconcile unless
> >an RDD were formed.
>
> >From arm's length...
>
> Ah, OK I got three minutes learning about json as
> suggested by one site and I think I already have a
> picture of what json is now. I saw a sample how a
> portion of grid, complete with its accesorial menus
> can be displayed on a website via json output. Very
> much interesting! Will try my best to make
> xHarbour interface to json functions this
> weekend. :)
I will be interested in how you handle the "fields that have array
contents".
Maybe a coupled pair of functions like memoread() / memowrit(), with a
hash table on the (x)Harbour side...
If I knew more than what the c functions were supposed to do, I'd
offer to help. Maybe I'll just get over my cold instead...
I see a lot of data structures being used like this in Graphical
Information Systems (GIS) and even the open source Audacity audio
program. Just rambling...
David A. Smith
|
|
0
|
|
|
|
Reply
|
dlzc
|
2/24/2011 2:31:55 PM
|
|
David said:
I will be interested in how you handle the "fields that have array
contents".
Maybe a coupled pair of functions like memoread() / memowrit(), with a
hash table on the (x)Harbour side...
If I knew more than what the c functions were supposed to do, I'd
offer to help. Maybe I'll just get over my cold instead...
I see a lot of data structures being used like this in Graphical
Information Systems (GIS) and even the open source Audacity audio
program. Just rambling...
Hi David (and Andi):
I've been following this discussion and have nothing very productive to
say except that if a json.lib is created, I'm sure that I could build it
into the xharbour version that is now available on the whosaway.com web
site.
btw, when I first built my 'Ajax' code between my client app and my
server two months ago , I was told (by an expert on another group) that I
should transfer data between my Javascript code on the client and my CGI app
on my server via the JSON method. Having a tired old brain, I couldn't
'wrap' myself around its intricacies, and thus went to Plan B :)) -- text
transfer.
So, I ended up simply transferring data between client and server as a
text string. Since I also had an array full of info to pass back to the
client, I separated array elements -- rows and columns (which contained
text, numbers, and dates -- all in ascii) with my own selected separators
(e.g., ^ ~, etc). This is a hold-your-nose solution, but for me it worked
and is working.
btw, the Ajax way (i.e. XHR -- XmlHttpRequest methods) is a hi-speed
way to communicate between client and server. From the time my client page
receives a key press (for an information request) until that request is
fulfilled, and the client page is updated is about one second ! If my
server CGI app has to look for info in its own databases, *or* go looking in
a public database, it usually takes fron 3 to 7 seconds. Still this XHR
stuff almost fools a person that they're working on a desktop app rather
than over the internet.
So, my understanding of JSON is that it is used basically as a formal
cross-browser method of formatting information for its transfer across the
internet between browser and server. My understanding is probably very
simplistic.
I've had a cold and bronchiitis for two weeks now. Hope we both get
better fast !
-Mel
|
|
0
|
|
|
|
Reply
|
Mel
|
2/24/2011 4:06:02 PM
|
|
Dear Mel Smith:
On Feb 24, 9:06=A0am, "Mel Smith" <med_cutout_syn...@aol.com> wrote:
....
> =A0 =A0 I've had a cold and bronchiitis for two weeks
> now. Hope we both get better fast !
I'm old enough to know better than to ride this through like I was a
teenager. So I guess I'll have to go to the doctor, before something
worse settles into the aftermath.
Maybe you too?
David A. Smith
|
|
0
|
|
|
|
Reply
|
dlzc
|
2/24/2011 4:39:26 PM
|
|
On Thu, 24 Feb 2011 00:40:05 -0800 (PST), pcordo
<perecordonet@gmail.com> wrote:
>On 24 Feb, 08:50, xharbour_del...@telkom.net.id (Andi Jahja) wrote:
>> On Wed, 23 Feb 2011 23:47:35 -0800 (PST), pcordo
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> <perecordo...@gmail.com> wrote:
>> >On 24 Feb, 03:57, xharbour_del...@telkom.net.id (Andi Jahja) wrote:
>> >> Dear David:
>>
>> >> Thanks for info. Sorry, I still don't get it. :(
>> >> Unless there is a sample code for me to see with my old eyes what the
>> >> function is really doing...
>>
>> >> I am pretty dumb in understanding narative description :(
>>
>> >> Andi
>>
>> >> On Wed, 23 Feb 2011 18:34:12 -0800 (PST), dlzc <dl...@cox.net> wrote:
>> >> >Dear Andi Jahja:
>>
>> >> >On Feb 23, 4:30 pm, xharbour_del...@telkom.net.id (Andi Jahja) wrote:
>>
>> >> >> What is this function actually doing? Could you give
>> >> >> an example? If it is worth, then we could include it
>> >> >> in xHarbour.
>>
>> >> >It is like an open source "spreadsheet" of sorts, or limited XML
>> >> >table. So it'd need an RDD wrapper to fit into the language
>> >> >transparently. The source code is open, presumably, and in C... so a
>> >> >LIB or DLL might be possible, but pretty difficult to reconcile unless
>> >> >an RDD were formed.
>>
>> >> >From arm's length...
>>
>> >> >David A. Smith
>>
>> >Hi Andi,
>>
>> >I try integrate my program with a web application through rest api.
>>
>> >The response of rest call is a json code.
>> >Ex:
>> >{
>> > � "data":
>> > � {
>> > � � �"edition": "Community",
>> > � � �"version": "3.4.0 (d 3370)",
>> > � � �"schema": "4113"
>> > � }
>> >}
>>
>> >I think, it's more easy adapt harbour code to xharbour. Can you adapt
>> >t'his code ?
>>
>> >I think, it's more easy adapt harbour code to xharbour. Can you adapt
>> >this code ? or we have a problem with licences.
>>
>> >Thank you Andi
>> >Pere
>>
>> Hi Pere:
>>
>> Yes, it is much easier of course. We don't have to reinvent a wheel.
>> Let me work on it this week end too :)
>>
>> Andi
>
>I will be sparse impatient ...
>
>Pere
Hi Pere:
OK. I have just uploaded JSON routine I quickly borrowed from Harbour:
2011-02-24 23:36 UTC+0700 Andi Jahja <xharbour/AT/telkom/net/id>
+ include/hbjson.h
+ source/rtl/hbjson.c
! JavaScript Object Notation (JSON) routines borrowed from Harbour
* winmake/common.mak
* winmake/compile.mak
+ object file dependency for hbjson.obj
Please update your SVN and play with it and report if there should be
any problem :)
Andi
|
|
0
|
|
|
|
Reply
|
xharbour_delete
|
2/24/2011 4:46:17 PM
|
|
David said:
I'm old enough to know better than to ride this through like I was a
teenager. So I guess I'll have to go to the doctor, before something
worse settles into the aftermath.
Maybe you too?
David:
I paid $1300 (Cdn) for *emergency* healthcare insurance down here in the
U.S. (for the winter for my wife and myself) -- and that includes a $5000
deductible !
So, I'm going to have to ride this cold/bronchitis out until I get back
home in early April to see a doctor (free, of course). I don't have the
money to see a doctor down here.
I had a bad case of constipation down here a year ago: one visit to the
ER here cost my Cdn government insurance $1200 (for a three minute visit,
and a laxative prescription), and I'm not covered for free insurance after
the 1st 40 days in the U.S. I'm on my commercial insurance (that I paid
for) now.
-Mel
|
|
0
|
|
|
|
Reply
|
Mel
|
2/24/2011 5:15:44 PM
|
|
Dear Mel Smith:
On Feb 24, 10:15=A0am, "Mel Smith" <med_cutout_syn...@aol.com> wrote:
> David said:
>
>> I'm old enough to know better than to ride this through
>> like I was a teenager. =A0So I guess I'll have to go to the
>> doctor, before something worse settles into the aftermath.
>
>> Maybe you too?
>
> =A0 =A0 I paid $1300 (Cdn) for *emergency* healthcare insurance
> down here in the U.S. (for the winter for my wife and myself)
> =A0-- and that includes a $5000 deductible !
I have a $5000 deductible at my place of work too. Funerals cost
$6000, or more.
> =A0 =A0 So, I'm going to have to ride this cold/bronchitis out
> until I get back home in early April to see a doctor (free,
> of course). =A0 I don't have the money to see a doctor down
> here.
Understood. You don't have the money to let her return home a widow
either. Shall I adopt you? You are only a few tens of miles from me
this time of year...
The fuse of your life is only so long. Letting illness shorten it is
preventable, to some extent.
> =A0 =A0 I had a bad case of constipation down here a year ago:
> =A0one visit to the ER here cost my Cdn government insurance
> $1200 (for a three minute visit, and a laxative prescription),
> and I'm not covered for free insurance after the 1st 40 days in
> the U.S. =A0I'm on my commercial insurance (that I paid
> for) now.
Laxative: Philips Milk of Magnesia. Also extra coffee sometimes
works, and so does doubling up on your thyroid. Also, products like
this for children.
OK. Sorry I don't want to get any further off topic... And no I
don't have any ideas to fix this that would get through either house
of our Congress.
David A. Smith
|
|
0
|
|
|
|
Reply
|
dlzc
|
2/24/2011 7:14:19 PM
|
|
On 24 Feb, 20:14, dlzc <dl...@cox.net> wrote:
> Dear Mel Smith:
>
> On Feb 24, 10:15=A0am, "Mel Smith" <med_cutout_syn...@aol.com> wrote:
>
> > David said:
>
> >> I'm old enough to know better than to ride this through
> >> like I was a teenager. =A0So I guess I'll have to go to the
> >> doctor, before something worse settles into the aftermath.
>
> >> Maybe you too?
>
> > =A0 =A0 I paid $1300 (Cdn) for *emergency* healthcare insurance
> > down here in the U.S. (for the winter for my wife and myself)
> > =A0-- and that includes a $5000 deductible !
>
> I have a $5000 deductible at my place of work too. =A0Funerals cost
> $6000, or more.
>
> > =A0 =A0 So, I'm going to have to ride this cold/bronchitis out
> > until I get back home in early April to see a doctor (free,
> > of course). =A0 I don't have the money to see a doctor down
> > here.
>
> Understood. =A0You don't have the money to let her return home a widow
> either. =A0Shall I adopt you? =A0You are only a few tens of miles from me
> this time of year...
>
> The fuse of your life is only so long. =A0Letting illness shorten it is
> preventable, to some extent.
>
> > =A0 =A0 I had a bad case of constipation down here a year ago:
> > =A0one visit to the ER here cost my Cdn government insurance
> > $1200 (for a three minute visit, and a laxative prescription),
> > and I'm not covered for free insurance after the 1st 40 days in
> > the U.S. =A0I'm on my commercial insurance (that I paid
> > for) now.
>
> Laxative: Philips Milk of Magnesia. =A0Also extra coffee sometimes
> works, and so does doubling up on your thyroid. =A0Also, products like
> this for children.
>
> OK. =A0Sorry I don't want to get any further off topic... =A0And no I
> don't have any ideas to fix this that would get through either house
> of our Congress.
>
> David A. Smith
Hi Andi,
I make a test file.
For encoding all is ok!!
But decoding don't return a varible passed for reference.
This is a my test file:
PROC main(cFile)
LOCAL xI
SetMode(24,80)
altd()
? "Decoding"
test("null")
test("true")
test(" false ")
test("123")
test("123.45")
test('"a"')
test('"Hello, JSON!"')
test('"Hello,\t\"JSON\"\u0021"')
test("[]")
test("{ }")
test('[1, true, "a" ]')
test('{ "a":1, "b" : 2 ,"c" :3, "d": [{"1":null, "2":false}, "4",
true]}')
test('"Saules radijas"')
? ""
? "Encoding"
? hb_jsonEncode()
? hb_jsonEncode( .T. )
? hb_jsonEncode( .F. )
? hb_jsonEncode( 123 )
? hb_jsonEncode( 123.45 )
? hb_jsonEncode( "a" )
? hb_jsonEncode( CHR(0) + 'b\"a' + CHR(13) )
? hb_jsonEncode( DATE() )
? hb_jsonEncode( {} )
? hb_jsonEncode( {=3D>} )
? hb_jsonEncode( {1,,.T., "hello"} )
? hb_jsonEncode( {"hello"=3D>"World", "one"=3D>1, 2=3D>"two", "three"=3D>{1=
,
2, 3}} )
xI :=3D {1, }
xI[ 2 ] :=3D xI
? hb_jsonEncode( xI ) // [1,null]
xI :=3D {1, .T.}
xI :=3D {2, xI, xI}
? hb_jsonEncode( xI ) // [2,[1,true],[1,true]]
IF cFile !=3D NIL
? ""
? "File decoding"
test( MEMOREAD( cFile ) )
ENDIF
wait
RETURN
PROC test( cJSON )
LOCAL xI, nI
nI :=3D hb_jsonDecode( cJSON, @xI )
IF nI > 0
? "OK:", nI, cJSON
? " ", ValToPrg( xI )
ELSE
? "ERROR", cJSON
ENDIF
RETURN
Can you test ?
Thank you.
There are a good job, Andi.
|
|
0
|
|
|
|
Reply
|
pcordo
|
2/26/2011 5:28:04 PM
|
|
Dear pcordo:
On Feb 26, 10:28=A0am, pcordo <perecordo...@gmail.com> wrote:
> I make a test file.
>
> For encoding all is ok!!
> But decoding don't return a varible passed for reference.
>
> This is a my test file:
>
> PROC main(cFile)
> LOCAL xI
> SetMode(24,80)
> altd()
>
> ? "Decoding"
> test("null")
> test("true")
> test(" =A0 false =A0")
> test("123")
> test("123.45")
> test('"a"')
> test('"Hello, JSON!"')
> test('"Hello,\t\"JSON\"\u0021"')
> test("[]")
> test("{ }")
Notice how you handle the curly braces above, in the example that
works.
> test('[1, true, "a" ]')
> test('{ "a":1, "b" : 2 ,"c" :3, "d": [{"1":null, "2":false}, "4",
> true]}')
> test('"Saules radijas"')
> ? ""
> ? "Encoding"
> ? hb_jsonEncode()
> ? hb_jsonEncode( .T. )
> ? hb_jsonEncode( .F. )
> ? hb_jsonEncode( 123 )
> ? hb_jsonEncode( 123.45 )
> ? hb_jsonEncode( "a" )
> ? hb_jsonEncode( CHR(0) + 'b\"a' + CHR(13) )
> ? hb_jsonEncode( DATE() )
> ? hb_jsonEncode( {} )
Notice how you don't do that here. Remember that curly braces are
used to surround code blocks, and may be being peeled off by the
compiler.
May have no effect on the result... not clear where it failed. Did
none of the encode calls work as expected?
David A. Smith
|
|
0
|
|
|
|
Reply
|
dlzc
|
2/26/2011 6:41:54 PM
|
|
|
18 Replies
390 Views
(page loaded in 0.257 seconds)
Similiar Articles: json functions - comp.lang.xharbourDear pcordo: On Feb 23, 4:49=A0am, pcordo <perecordo...@gmail.com> wrote: > > Someone has to implement json function of harbour project ? > > It's possible to ... JSON objects sent as a http request - comp.lang.java.help ...The http address needs to include JSON objects because the JavaScript/Java functions at the web application are expecting to receive them as parameters. Setting JSON key from a variable? - comp.lang.javascript ...json functions - comp.lang.xharbour Setting JSON key from a variable? - comp.lang.javascript ... Hi, I am trying to build a json object from a predefined variable. Serialization in Matlab - comp.soft-sys.matlabBut no JSON/BSON, protocol buffers or other known formats at all. Do any ... json functions - comp.lang.xharbour Serialization in Matlab - comp.soft-sys.matlab But no ... How to similate HTTP POST request by JavaScript? - comp.lang ...json functions - comp.lang.xharbour How to similate HTTP POST request by JavaScript? - comp.lang ... When I select from combo box. onClick will call JavaScript function. 'Deferred' functions? - comp.lang.javascriptI want this function to send HTTP POST request with the selected index of the ... JSON objects sent as a http request - comp.lang.java ... 'Deferred' functions? - comp ... remove any commas/data from mysql? - comp.databases.mysql ...json functions - comp.lang.xharbour remove any commas/data from mysql? - comp.databases.mysql ..... since it looks like you're using php, look at the php manual for the ... Translate char to virtual key code to set mnenonic - comp.lang ...json functions - comp.lang.xharbour... with minimal effort, since c code is available: http://www.json.org/ I see serious collisions between the simple character ... pass ... Request from Outside ... - comp.sys.ibm.ps2.hardwarejson functions - comp.lang.xharbour Request from Outside ... - comp.sys.ibm.ps2.hardware C) Use OpenOffice Write "Export to PDF" function, but you need to create a document ... FiveWin for [x]Harbour, version 6.12, now free of cost - comp.lang ...json functions - comp.lang.xharbour... between the simple character mapping of (x)Harbour and ... Andi On Wed, 23 Feb 2011 18:34:12 -0800 (PST ... that I could build it ... Best way to implement drag and drop for a DIV? - comp.lang ...json functions - comp.lang.xharbour or show me the way to call these functions? Thank ... Will try my best to make xHarbour interface to json ... to a Table Grid in HTML ... parsing name value pairs - comp.lang.awkjson functions - comp.lang.xharbour parsing name value pairs - comp.lang.awk Parsing Tcl lists... in JavaScript - comp.lang.tcl JSON key from a variable? - comp ... Error: Couldn't find unicodeMap file for the ____ encoding - comp ...json functions - comp.lang.xharbour Having a tired old brain, I couldn't ... com> wrote: > I make a test file. > > For encoding all is ok!! > But decoding don't ... Convert an HTTP responseText into a DOM document object - comp ...function getXMLDocument( ajax ) { if (typeof DOMParser == "undefined") { DOMParser ... JSON objects sent as a http request - comp.lang.java.help ... Convert an HTTP ... Dynamicly add dropdown lists to a form populated with php/mysql ...json functions - comp.lang.xharbour NETBEANS] How to display query result in a grid - comp ... Dynamicly add dropdown lists to a form populated with php/mysql ..... it to ... JSON in JavaScriptValues that do not have a representation in JSON (such as functions and undefined) are excluded. Nonfinite numbers are replaced with null. To substitute other values ... Sending Javascript Functions Over JSON | Solutoire.comIn this post I’ll present a way to send javascript functions over JSON from a php server (but it should work on other platforms too). Since PHP version 5.20 PHP ... 7/29/2012 11:30:01 AM
|