JsonGetValueRecursive(jsnHandle As Integer, JsnIndex As Integer, childName As String) As String

 

Find the value for a specific name within a json object at position of JsnIndex.

 

 

 

Parameters:

 

Name

Type

Description

jsnHandle

Integer

Identification number for existing JSON object, instantiated with the JSONCreate method

JsnIndex

Integer

Index number of json object within current JSON object.

Counting starts at 0

childName

String

key name for which value must be returned

 

Returns:

 

Type

Value

Description

String

value from requested key name

 

Available in:

 

WindowMain

WindowLink

YES

NO

 

 

Example XojoScript:

 

// Instantiate htmlConnection object

Dim conID As String = htmlConnection

 

// Define path to test webservice

Dim url As String = "https://test.nwscloud.ch/test"

 

// Send a GET Request to the webservice

Dim json As String = htmlsendSync(conID,"GET", url,15)

'MsgBox(json)

 

// Create JSON Object

Dim jsnID1 As Integer = JsonCreateFromString(json)

 

// Get json string with person data

Dim person As String = jsongetValue(jsnID1,"person")

'MsgBox(person)

 

// Create JSON Object for person data

Dim jsnID2 As Integer = JsonCreateFromString(person)

 

// phones is on 3rd position of person object, index = 2

// we want to retrieve the value for "home" from the 3rd object

Dim mobile As String = JsonGetValueRecursive(jsnID2,2,"mobile")

MsgBox(mobile)

 

// Close connection to webservice

Call htmlConnectionClose(conID)

 

 

 

 

 

 

JSON response string from test.nwscloud.ch/test

 

Ein Bild, das Text enthält.

Automatisch generierte Beschreibung