FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Validate JSON value
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
Validate JSON value
Posted: Thu Dec 08, 2022 02: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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Validate JSON value
Posted: Thu Dec 08, 2022 03:45 AM
Code (fw): Select all Collapse
if hb_hHasKey( hCall[ "facility" ], "UNLocationCode" )
   ? "exists"
else
   ? "does not exist"
endif
xHarbour: hHasKey( ... )
Regards



G. N. Rao.

Hyderabad, India
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
Re: Validate JSON value
Posted: Thu Dec 08, 2022 03:55 AM

Thank Your Rao!

*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com

Continue the discussion