Galbar / JsonPath-PHP

A JsonPath implementation in PHP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't create json for $.1 ($.integer)

shalithaRukshan opened this issue · comments

code:
$jsonObject = new JsonObject();
$jsonObject->set('$.1','asdf');
dd($jsonObject->getJson());


error : InvalidJsonPathExceptionError in JSONPath near '.1'

Hi!
The following should work:
$jsonObject->set('$[1]','asdf');
or
$jsonObject->set('$["1"]','asdf');