cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Rest API with json format

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".