> ## Documentation Index
> Fetch the complete documentation index at: https://docs.falkordb.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> FalkorDB is a graph database that speaks the Redis protocol. Queries are issued as OpenCypher through the GRAPH.QUERY and GRAPH.RO_QUERY commands, not over Bolt or a SQL connection.
> FalkorDB implements a subset of OpenCypher with proprietary extensions. Do not assume Neo4j-only syntax or procedures are available — check /cypher/cypher-support and /cypher/known-limitations before using a clause.
> FalkorDB is the successor to RedisGraph, but they are separate products. Do not present RedisGraph commands, versions, or limitations as current FalkorDB behavior.
> Use the official clients listed in /getting-started/clients rather than generic Redis or Neo4j drivers, and prefer the language the user is already working in.
> Configuration parameters are set with GRAPH.CONFIG SET or at startup; cite the exact parameter name from /getting-started/configuration rather than inventing one.
> This site covers four products: FalkorDB (core), FalkorDB Cloud, FalkorDB Enterprise, and the GraphRAG SDK. Name which one an answer applies to, since setup and operations differ.

# json.fromJsonMap

> Parses a JSON string and returns it as a map, returning an empty map on parse errors.

## Description

Parses a JSON string and returns it as a map (object). Safely handles malformed JSON by returning an empty map on parse errors.

## Syntax

```cypher theme={null}
flex.json.fromJsonMap(jsonString)
```

## Parameters

| Parameter    | Type   | Required | Description                          |
| ------------ | ------ | -------- | ------------------------------------ |
| `jsonString` | string | Yes      | A JSON string representing an object |

## Returns

**Type:** map (object)

A map parsed from the JSON string. Returns an empty map `{}` if parsing fails or if the input is not a valid JSON object.

## Examples

### Example 1: Basic JSON Parsing

```cypher theme={null}
WITH '{"name":"Alice","age":30,"active":true}' AS json
RETURN flex.json.fromJsonMap(json) AS user
```

**Output:**

```text theme={null}
user
-------------------------------
{name: 'Alice', age: 30, active: true}
```

### Example 2: Parsing Stored JSON Properties

```cypher theme={null}
MATCH (n:Node)
WHERE n.jsonData IS NOT NULL
WITH n, flex.json.fromJsonMap(n.jsonData) AS parsed
RETURN n.id, parsed.field1, parsed.field2
```

### Example 3: Processing API Responses

```cypher theme={null}
WITH '{"id":123,"email":"user@example.com","role":"admin"}' AS apiResponse
WITH flex.json.fromJsonMap(apiResponse) AS data
CREATE (u:User {id: data.id, email: data.email, role: data.role})
```

### Example 4: Handling Malformed JSON

```cypher theme={null}
WITH '{invalid json}' AS badJson
RETURN flex.json.fromJsonMap(badJson) AS result
```

**Output:**

```text theme={null}
result
------
{}
```

(Returns empty map for invalid JSON)

## Notes

* Returns empty map `{}` if input is not valid JSON
* Returns empty map if the JSON represents a non-object value (e.g., array, string)
* Safe to use without error handling as it won't throw exceptions
* Useful for parsing configuration, API responses, or stored JSON data

## See Also

* [json.fromJsonList](/udfs/flex/json/fromJsonList) - Parse JSON string to list
* [json.toJson](/udfs/flex/json/toJson) - Serialize value to JSON string

## Frequently Asked Questions

<AccordionGroup>
  <Accordion title="What does flex.json.fromJsonMap return for invalid JSON?">
    It safely returns an empty map `{}` without throwing an exception, making it safe to use without error handling.
  </Accordion>

  <Accordion title="Can I access nested properties from the parsed map?">
    Yes. Once parsed, you can use dot notation to access nested properties, e.g., `parsed.field1`.
  </Accordion>
</AccordionGroup>
