0

I have a JSONArray like this

[
  {
    "id": 64,
    "name": "leroy"
  },
  {
    "id": 82,
    "name": "guillaume"
  }
]

Is it possible to return this instead, with PHP?

{
  "id": 64,
  "name": "leroy"
},
{
  "id": 82,
  "name": "guillaume"
}

Thanks,

2
  • 5
    Why do you want to do that? The first output is valid JSON, the second one is not. Commented Feb 29, 2016 at 10:40
  • Oh okay, I thought this would be valid too. Commented Feb 29, 2016 at 11:05

1 Answer 1

1

please use below code for remove brackets in json

str_replace(array('[', ']'), '', htmlspecialchars(json_encode($result), ENT_NOQUOTES));
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.