cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Rest API with json format

   Did you know you can see the translated content as per your choice?

Translation is in progress. Please check again after few minutes.

Custom Rest API with json format

I am trying to create Magento 2.3 custom rest API but couldn't get JSON response. 

Expected: 

{

 "status" : true,

 "dattails": [

   {"id": ""}, {"id": ""}

]

}

Actual:

[true] (array format)

 

How to solve this issue? Anyone can help me?

1 REPLY 1

Re: Custom Rest API with json format

Hi @jothi_vijila1 

 

Try to modify your return statement as below.

 

return json_decode(json_encode($arr), true);

 

Thanks

---
If you've found my answer useful, please give"Kudos" and "Accept as Solution".