Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

What is algebra, exactly? Is it one of those three-cornered things? -- J. M. Barrie


devel / comp.lang.xharbour / hb_jsonencode / hb_jsondecode with date values

SubjectAuthor
* hb_jsonencode / hb_jsondecode with date valuesPere Cordonet
+- Re: hb_jsonencode / hb_jsondecode with date valuesMel Smith
+- Re: hb_jsonencode / hb_jsondecode with date valuesElla Stern
`* Re: hb_jsonencode / hb_jsondecode with date valuesElla Stern
 `* Re: hb_jsonencode / hb_jsondecode with date valuesPere Cordonet
  `* Re: hb_jsonencode / hb_jsondecode with date valuesMel Smith
   `- Re: hb_jsonencode / hb_jsondecode with date valuesMel Smith

1
hb_jsonencode / hb_jsondecode with date values

<c1bcd0fe-e784-41c4-8be7-956769b63abdn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16787&group=comp.lang.xharbour#16787

  copy link   Newsgroups: comp.lang.xharbour
X-Received: by 2002:a05:6214:590:: with SMTP id bx16mr5307215qvb.45.1632834448613;
Tue, 28 Sep 2021 06:07:28 -0700 (PDT)
X-Received: by 2002:a05:622a:144b:: with SMTP id v11mr5430216qtx.320.1632834448396;
Tue, 28 Sep 2021 06:07:28 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.xharbour
Date: Tue, 28 Sep 2021 06:07:28 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=91.126.218.201; posting-account=C5eGVgoAAACHo46fK5-WqEvcgacVMyKC
NNTP-Posting-Host: 91.126.218.201
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <c1bcd0fe-e784-41c4-8be7-956769b63abdn@googlegroups.com>
Subject: hb_jsonencode / hb_jsondecode with date values
From: perecordonet@gmail.com (Pere Cordonet)
Injection-Date: Tue, 28 Sep 2021 13:07:28 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 22
 by: Pere Cordonet - Tue, 28 Sep 2021 13:07 UTC

Hello,
I have a problems with date values when i call hb_jsonencode and hb_jsondecode

After call hb_jsondecode date value is a number value.

Can anyone test this code?

Function Main()
Local cJson,xVar

SetMode( 24 , 80 )

SET DATE BRITISH
Set(_SET_DATEFORMAT,"DD/MM/YYYY")

cJson:= hb_jsonencode( {"DATE"=> Stod("20210401") } )

Hb_jsondecode( cJson , @xVar )
? xVar["DATE"]

Return

Thank you.

Re: hb_jsonencode / hb_jsondecode with date values

<91becaf3-d26d-4f32-84af-e1c648ed0ed9n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16788&group=comp.lang.xharbour#16788

  copy link   Newsgroups: comp.lang.xharbour
X-Received: by 2002:ac8:7397:: with SMTP id t23mr6203584qtp.63.1632842065119;
Tue, 28 Sep 2021 08:14:25 -0700 (PDT)
X-Received: by 2002:ac8:490f:: with SMTP id e15mr6019617qtq.132.1632842064942;
Tue, 28 Sep 2021 08:14:24 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.xharbour
Date: Tue, 28 Sep 2021 08:14:24 -0700 (PDT)
In-Reply-To: <c1bcd0fe-e784-41c4-8be7-956769b63abdn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=96.52.125.244; posting-account=dQ0_awoAAABF2-Sui2Av5bZD8Vt8zYRC
NNTP-Posting-Host: 96.52.125.244
References: <c1bcd0fe-e784-41c4-8be7-956769b63abdn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <91becaf3-d26d-4f32-84af-e1c648ed0ed9n@googlegroups.com>
Subject: Re: hb_jsonencode / hb_jsondecode with date values
From: medsyntel@gmail.com (Mel Smith)
Injection-Date: Tue, 28 Sep 2021 15:14:25 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 30
 by: Mel Smith - Tue, 28 Sep 2021 15:14 UTC

On Tuesday, September 28, 2021 at 7:07:29 AM UTC-6, pereco...@gmail.com wrote:
> Hello,
> I have a problems with date values when i call hb_jsonencode and hb_jsondecode
>
> After call hb_jsondecode date value is a number value.
>
> Can anyone test this code?
>
> Function Main()
> Local cJson,xVar
>
> SetMode( 24 , 80 )
>
> SET DATE BRITISH
> Set(_SET_DATEFORMAT,"DD/MM/YYYY")
>
> cJson:= hb_jsonencode( {"DATE"=> Stod("20210401") } )
>
> Hb_jsondecode( cJson , @xVar )
> ? xVar["DATE"]
>
> Return
>
> Thank you.

Hi Pereco:

When compiled with xHarbour under BCC 7.4 , the result is a numeric: 2459306 (Number of days since base date ???)
When compiled under Harbour under MInGW, the result is a Character string: "20210401"

-Mel Smith

Re: hb_jsonencode / hb_jsondecode with date values

<ce8b63dd-af78-4835-a700-464c28953729n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16789&group=comp.lang.xharbour#16789

  copy link   Newsgroups: comp.lang.xharbour
X-Received: by 2002:a37:547:: with SMTP id 68mr1823045qkf.491.1632859313198;
Tue, 28 Sep 2021 13:01:53 -0700 (PDT)
X-Received: by 2002:a37:f515:: with SMTP id l21mr1870789qkk.234.1632859312947;
Tue, 28 Sep 2021 13:01:52 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.xharbour
Date: Tue, 28 Sep 2021 13:01:52 -0700 (PDT)
In-Reply-To: <c1bcd0fe-e784-41c4-8be7-956769b63abdn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=82.79.141.111; posting-account=H3ofRwoAAADbRxQ3Wi989fFKCMQ4Av_J
NNTP-Posting-Host: 82.79.141.111
References: <c1bcd0fe-e784-41c4-8be7-956769b63abdn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <ce8b63dd-af78-4835-a700-464c28953729n@googlegroups.com>
Subject: Re: hb_jsonencode / hb_jsondecode with date values
From: ellailona@gmail.com (Ella Stern)
Injection-Date: Tue, 28 Sep 2021 20:01:53 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 25
 by: Ella Stern - Tue, 28 Sep 2021 20:01 UTC

On Tuesday, September 28, 2021 at 4:07:29 PM UTC+3, pereco...@gmail.com wrote:
> Hello,
> I have a problems with date values when i call hb_jsonencode and hb_jsondecode
>
> After call hb_jsondecode date value is a number value.
>
> Can anyone test this code?
>
> Function Main()
> Local cJson,xVar
>
> SetMode( 24 , 80 )
>
> SET DATE BRITISH
> Set(_SET_DATEFORMAT,"DD/MM/YYYY")
>
> cJson:= hb_jsonencode( {"DATE"=> Stod("20210401") } )
>
> Hb_jsondecode( cJson , @xVar )
> ? xVar["DATE"]
>
> Return
>
> Thank you.

In JavaScript and in JSON there is no "date" primitive data type - you need to convert your date value into string before converting it.

Re: hb_jsonencode / hb_jsondecode with date values

<e50f9d0c-0aa4-4766-9700-2d357ccabe6an@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16790&group=comp.lang.xharbour#16790

  copy link   Newsgroups: comp.lang.xharbour
X-Received: by 2002:a37:688b:: with SMTP id d133mr1948666qkc.352.1632859459061;
Tue, 28 Sep 2021 13:04:19 -0700 (PDT)
X-Received: by 2002:a0c:aa5c:: with SMTP id e28mr7578556qvb.2.1632859458942;
Tue, 28 Sep 2021 13:04:18 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.xharbour
Date: Tue, 28 Sep 2021 13:04:18 -0700 (PDT)
In-Reply-To: <c1bcd0fe-e784-41c4-8be7-956769b63abdn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=82.79.141.111; posting-account=H3ofRwoAAADbRxQ3Wi989fFKCMQ4Av_J
NNTP-Posting-Host: 82.79.141.111
References: <c1bcd0fe-e784-41c4-8be7-956769b63abdn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e50f9d0c-0aa4-4766-9700-2d357ccabe6an@googlegroups.com>
Subject: Re: hb_jsonencode / hb_jsondecode with date values
From: ellailona@gmail.com (Ella Stern)
Injection-Date: Tue, 28 Sep 2021 20:04:19 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 26
 by: Ella Stern - Tue, 28 Sep 2021 20:04 UTC

On Tuesday, September 28, 2021 at 4:07:29 PM UTC+3, pereco...@gmail.com wrote:
> Hello,
> I have a problems with date values when i call hb_jsonencode and hb_jsondecode
>
> After call hb_jsondecode date value is a number value.
>
> Can anyone test this code?
>
> Function Main()
> Local cJson,xVar
>
> SetMode( 24 , 80 )
>
> SET DATE BRITISH
> Set(_SET_DATEFORMAT,"DD/MM/YYYY")
>
> cJson:= hb_jsonencode( {"DATE"=> Stod("20210401") } )
>
> Hb_jsondecode( cJson , @xVar )
> ? xVar["DATE"]
>
> Return
>
> Thank you.

In JavaScript and in JSON there is no "date" primitive data type - you need to convert your date value into string.

Re: hb_jsonencode / hb_jsondecode with date values

<52685d7d-f0ac-4791-8b63-363254a01cf0n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16791&group=comp.lang.xharbour#16791

  copy link   Newsgroups: comp.lang.xharbour
X-Received: by 2002:ae9:efc9:: with SMTP id d192mr3709675qkg.366.1632895981882;
Tue, 28 Sep 2021 23:13:01 -0700 (PDT)
X-Received: by 2002:ad4:4b31:: with SMTP id s17mr4896025qvw.23.1632895981701;
Tue, 28 Sep 2021 23:13:01 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!4.us.feeder.erje.net!2.eu.feeder.erje.net!feeder.erje.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.xharbour
Date: Tue, 28 Sep 2021 23:13:01 -0700 (PDT)
In-Reply-To: <e50f9d0c-0aa4-4766-9700-2d357ccabe6an@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=91.126.218.201; posting-account=C5eGVgoAAACHo46fK5-WqEvcgacVMyKC
NNTP-Posting-Host: 91.126.218.201
References: <c1bcd0fe-e784-41c4-8be7-956769b63abdn@googlegroups.com> <e50f9d0c-0aa4-4766-9700-2d357ccabe6an@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <52685d7d-f0ac-4791-8b63-363254a01cf0n@googlegroups.com>
Subject: Re: hb_jsonencode / hb_jsondecode with date values
From: perecordonet@gmail.com (Pere Cordonet)
Injection-Date: Wed, 29 Sep 2021 06:13:01 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Pere Cordonet - Wed, 29 Sep 2021 06:13 UTC

El dia dimarts, 28 de setembre de 2021 a les 22:04:19 UTC+2, Ella Stern va escriure:
> On Tuesday, September 28, 2021 at 4:07:29 PM UTC+3, pereco...@gmail.com wrote:
> > Hello,
> > I have a problems with date values when i call hb_jsonencode and hb_jsondecode
> >
> > After call hb_jsondecode date value is a number value.
> >
> > Can anyone test this code?
> >
> > Function Main()
> > Local cJson,xVar
> >
> > SetMode( 24 , 80 )
> >
> > SET DATE BRITISH
> > Set(_SET_DATEFORMAT,"DD/MM/YYYY")
> >
> > cJson:= hb_jsonencode( {"DATE"=> Stod("20210401") } )
> >
> > Hb_jsondecode( cJson , @xVar )
> > ? xVar["DATE"]
> >
> > Return
> >
> > Thank you.
> In JavaScript and in JSON there is no "date" primitive data type - you need to convert your date value into string.

Good morning,

I found the problem.
I'm compile with xhb.com.

In file "hbjson.c" at function "_hb_jsonEncode", i changed the order of " else if( HB_IS_DATE( pValue ) )" before of " else if( HB_IS_NUMERIC( pValue ) )" and work fine.

It's strange, but works.

Can you make this changes to repository?

Thank you
Pere.

Re: hb_jsonencode / hb_jsondecode with date values

<a3b91945-7c82-4e34-9d17-79bfc1d3a1b2n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16792&group=comp.lang.xharbour#16792

  copy link   Newsgroups: comp.lang.xharbour
X-Received: by 2002:ac8:435e:: with SMTP id a30mr468013qtn.227.1632928963824;
Wed, 29 Sep 2021 08:22:43 -0700 (PDT)
X-Received: by 2002:a05:6214:a6c:: with SMTP id ef12mr557361qvb.2.1632928963639;
Wed, 29 Sep 2021 08:22:43 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.xharbour
Date: Wed, 29 Sep 2021 08:22:43 -0700 (PDT)
In-Reply-To: <52685d7d-f0ac-4791-8b63-363254a01cf0n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=96.52.125.244; posting-account=dQ0_awoAAABF2-Sui2Av5bZD8Vt8zYRC
NNTP-Posting-Host: 96.52.125.244
References: <c1bcd0fe-e784-41c4-8be7-956769b63abdn@googlegroups.com>
<e50f9d0c-0aa4-4766-9700-2d357ccabe6an@googlegroups.com> <52685d7d-f0ac-4791-8b63-363254a01cf0n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <a3b91945-7c82-4e34-9d17-79bfc1d3a1b2n@googlegroups.com>
Subject: Re: hb_jsonencode / hb_jsondecode with date values
From: medsyntel@gmail.com (Mel Smith)
Injection-Date: Wed, 29 Sep 2021 15:22:43 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 47
 by: Mel Smith - Wed, 29 Sep 2021 15:22 UTC

On Wednesday, September 29, 2021 at 12:13:02 AM UTC-6, pereco...@gmail.com wrote:
> El dia dimarts, 28 de setembre de 2021 a les 22:04:19 UTC+2, Ella Stern va escriure:
> > On Tuesday, September 28, 2021 at 4:07:29 PM UTC+3, pereco...@gmail.com wrote:
> > > Hello,
> > > I have a problems with date values when i call hb_jsonencode and hb_jsondecode
> > >
> > > After call hb_jsondecode date value is a number value.
> > >
> > > Can anyone test this code?
> > >
> > > Function Main()
> > > Local cJson,xVar
> > >
> > > SetMode( 24 , 80 )
> > >
> > > SET DATE BRITISH
> > > Set(_SET_DATEFORMAT,"DD/MM/YYYY")
> > >
> > > cJson:= hb_jsonencode( {"DATE"=> Stod("20210401") } )
> > >
> > > Hb_jsondecode( cJson , @xVar )
> > > ? xVar["DATE"]
> > >
> > > Return
> > >
> > > Thank you.
> > In JavaScript and in JSON there is no "date" primitive data type - you need to convert your date value into string.
> Good morning,
>
> I found the problem.
> I'm compile with xhb.com.
>
> In file "hbjson.c" at function "_hb_jsonEncode", i changed the order of " else if( HB_IS_DATE( pValue ) )" before of " else if( HB_IS_NUMERIC( pValue ) )" and work fine.
>
> It's strange, but works.
>
> Can you make this changes to repository?
>
> Thank you
> Pere.

Hi Pere Cordonet:
I confirm that the change you made to hbjson.c corrects the error-- so that the return is the character string "20210401" Good detective work !
However, I have no idea *why* it works ?? !!
Because in this particular section of the code, the Harbour version is identical to the original code in xHarbour. !
I don't understand how the (pValue) can be both NUMERIC *and* DATE at the same time.
What is happening here ???
-Mel Smith

Re: hb_jsonencode / hb_jsondecode with date values

<3b65f810-0642-43a9-a3b5-e04f54de9d1dn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16793&group=comp.lang.xharbour#16793

  copy link   Newsgroups: comp.lang.xharbour
X-Received: by 2002:aed:2794:: with SMTP id a20mr1830435qtd.243.1632942957602;
Wed, 29 Sep 2021 12:15:57 -0700 (PDT)
X-Received: by 2002:ad4:53a7:: with SMTP id j7mr88026qvv.15.1632942957409;
Wed, 29 Sep 2021 12:15:57 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.xharbour
Date: Wed, 29 Sep 2021 12:15:57 -0700 (PDT)
In-Reply-To: <a3b91945-7c82-4e34-9d17-79bfc1d3a1b2n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=96.52.125.244; posting-account=dQ0_awoAAABF2-Sui2Av5bZD8Vt8zYRC
NNTP-Posting-Host: 96.52.125.244
References: <c1bcd0fe-e784-41c4-8be7-956769b63abdn@googlegroups.com>
<e50f9d0c-0aa4-4766-9700-2d357ccabe6an@googlegroups.com> <52685d7d-f0ac-4791-8b63-363254a01cf0n@googlegroups.com>
<a3b91945-7c82-4e34-9d17-79bfc1d3a1b2n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <3b65f810-0642-43a9-a3b5-e04f54de9d1dn@googlegroups.com>
Subject: Re: hb_jsonencode / hb_jsondecode with date values
From: medsyntel@gmail.com (Mel Smith)
Injection-Date: Wed, 29 Sep 2021 19:15:57 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 52
 by: Mel Smith - Wed, 29 Sep 2021 19:15 UTC

On Wednesday, September 29, 2021 at 9:22:44 AM UTC-6, Mel Smith wrote:
> On Wednesday, September 29, 2021 at 12:13:02 AM UTC-6, pereco...@gmail.com wrote:
> > El dia dimarts, 28 de setembre de 2021 a les 22:04:19 UTC+2, Ella Stern va escriure:
> > > On Tuesday, September 28, 2021 at 4:07:29 PM UTC+3, pereco...@gmail.com wrote:
> > > > Hello,
> > > > I have a problems with date values when i call hb_jsonencode and hb_jsondecode
> > > >
> > > > After call hb_jsondecode date value is a number value.
> > > >
> > > > Can anyone test this code?
> > > >
> > > > Function Main()
> > > > Local cJson,xVar
> > > >
> > > > SetMode( 24 , 80 )
> > > >
> > > > SET DATE BRITISH
> > > > Set(_SET_DATEFORMAT,"DD/MM/YYYY")
> > > >
> > > > cJson:= hb_jsonencode( {"DATE"=> Stod("20210401") } )
> > > >
> > > > Hb_jsondecode( cJson , @xVar )
> > > > ? xVar["DATE"]
> > > >
> > > > Return
> > > >
> > > > Thank you.
> > > In JavaScript and in JSON there is no "date" primitive data type - you need to convert your date value into string.
> > Good morning,
> >
> > I found the problem.
> > I'm compile with xhb.com.
> >
> > In file "hbjson.c" at function "_hb_jsonEncode", i changed the order of " else if( HB_IS_DATE( pValue ) )" before of " else if( HB_IS_NUMERIC( pValue ) )" and work fine.
> >
> > It's strange, but works.
> >
> > Can you make this changes to repository?
> >
> > Thank you
> > Pere.
> Hi Pere Cordonet:
> I confirm that the change you made to hbjson.c corrects the error-- so that the return is the character string "20210401" Good detective work !
> However, I have no idea *why* it works ?? !!
> Because in this particular section of the code, the Harbour version is identical to the original code in xHarbour. !
> I don't understand how the (pValue) can be both NUMERIC *and* DATE at the same time.
> What is happening here ???
> -Mel Smith

Hi Luiz
Can you investigate this problem reported by Pere Cordonet ?
Thank you.
-Mel

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor