Validate JSON value

Validate JSON value

Postby cdmmaui » Thu Dec 08, 2022 2:19 am

Hello,

Sorry about all the JSON questions. How do I check to see if a JSON segment exists?

For example, I want to know if there is a value for:

hCall[ "facility" ][ "UNLocationCode" ]

Thank you,
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong

Re: Validate JSON value

Postby nageswaragunupudi » Thu Dec 08, 2022 3:45 am

Code: Select all  Expand view

if hb_hHasKey( hCall[ "facility" ], "UNLocationCode" )
   ? "exists"
else
   ? "does not exist"
endif
 


xHarbour: hHasKey( ... )
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10643
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Validate JSON value

Postby cdmmaui » Thu Dec 08, 2022 3:55 am

Thank Your Rao!
*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
User avatar
cdmmaui
 
Posts: 689
Joined: Fri Oct 28, 2005 9:53 am
Location: Houston ∙ Chicago ∙ Los Angeles ∙ Miami ∙ London ∙ Hong Kong


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 89 guests