JSON node

JSON Keys

Extract all keys from a JSON object as an array of strings.

Inputs

PortType
InputThe object whose key names you want, listed in the order they arrived. Arrays and plain values have no keys, so the result comes back empty with Count 0.json

Outputs

PortType
Keysjson
Countint

Screenshots

JSON Keys
JSON Keys

Overview

JSON Keys reads all top-level keys from a JSON object and outputs them as a JSON array of strings. The Count output provides the total number of keys. For OrderedJSON objects, keys are returned in their original insertion order. For plain dictionaries, keys are returned in sorted alphabetical order.

If the input is not a JSON object (for example, an array or a primitive value), both outputs return empty results.

Examples

Extract keys from an object:

Input: {"name": "circle", "radius": 1.5, "color": "red"}

Keys: ["name", "radius", "color"], Count: 3

Empty object:

Input: {}

Keys: [], Count: 0

Non-object input:

Input: [1, 2, 3]

Keys: [], Count: 0

Ordered keys preserved:

If the input was built with JSON Object (which uses OrderedJSON), keys appear in the order they were added, not alphabetically sorted.

Use Cases

  • Discovering the structure of an unknown JSON object
  • Iterating over keys by feeding the Keys array into JSON Array Get with a counter
  • Validating that expected keys are present in a data payload
  • Building dynamic UI or display logic based on available keys

Tips

  • Keys are always strings, regardless of the value types they map to.
  • Combine with JSON Array Get to iterate through keys and then use JSON Get to retrieve each value.
  • The Count output is equivalent to what JSON Length would return for the same object.
  • Key order from OrderedJSON sources (JSON Object, JSON Merge) is preserved — useful when order carries semantic meaning.

A ready-made example project for this node is built into Grafit Pro: select the node in the library and open or drag the example from its description panel.

Open JSON Keys in the interactive catalog →

JSON Keys is one of 381 nodes in Grafit Pro.

Free download. Every feature for 7 days, no card. Then €99.99 once — or keep playing your projects as a Player.

More JSON nodes