Previous Topic

Next Topic

Book Contents

Book Index

JSONGetKeys - MaxBasic function

JSONGetKeys(JSONObject: Object): Stringlist

Takes a JSON Object and returns a StringList containing the top level key name of the object.

JSONGetKeys function has these named arguments:

Parameter

Description

JSON Object

Required. A JSON Object to return keys for.

Sample code:

const Filename = "C:\data\Invoices.json"

If not FileExists(Filename) Then Error("File " & FileName & " not found")

Dim Invoices as Object

Invoices = ParseJSONFromFile(FileName)

Dim History as Object

History = Invoices.InvoiceHistory

Dim Keys as Object

Keys = JSONGetKeys(History)

Print "Total number of Keys: " & Keys.Count

Print "Keys:"

for each key in Keys

Print key

next