cancel
Showing results for 
Search instead for 
Did you mean: 

Passing JSON Formatted Objects to the Browser as Params

eric2
Node

I can pass a JSON object to a cypher query using the driver... but It doesn't seem possible to pass an object to the browser using the :params function.

:params obj => { name: "eric", state: "confused" }

Any suggestions?

1 REPLY 1

glilienfield
Ninja
Ninja

The syntax for :params and :param is different. There is no top-level variable with :params.

Try:

:params { name: "eric", state: "confused" }

Then reference $name and $state in your cypher code in the browser.

If you do want a top-level variable with param and assign it a map, you can use the following syntax.

:param x => ({a: 1, b: 2})

then, you would have $x.a and $x.b

One difference I noticed between :param and :params, is that :params treats numbers as floats, thus setting a value to 1 is interpreted as 1.0.

for more info: