How to output JSON data correctly using PHP

前端 未结 7 1463
时光说笑
时光说笑 2021-01-04 04:03

I\'m developing an Android app, and for the API I\'m sending my requests to a URL that should return JSON data.

This is what I\'m getting in my output:

7条回答
  •  时光说笑
    2021-01-04 04:13

    Your JSON response is already in good shape. The reponse you are viewing is in Chrome browser. Thats why it looks like that . If you add below line in yoru code

    var_dump($response); and then rightclick -> view source in chrome brower , you will see the tree structure. Anyway you can copy your JSON reponse and check the validy here

    The same thing I belive first when I saw it in chrome . It happens to me also.

提交回复
热议问题