Questions tagged [json-response]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers

Strange AJAX error in Magento 2.4

I developed a module for Magento 2.4 that consumes an API with multiple endpoints and one of them is returning the response as JSON. If I create an AJAX call, the response I will get on the desktop ...
iupaem's user avatar
  • 31
0 votes
1 answer

Magento2 : How to set JSON response from custom rest API

I'm building a custom rest API endpoint. This is code which I have written in my custom model class. return [ ['success' => false, 'status-title' => 'Refund Failed',] ]; Following ...
Suresh Chikani's user avatar
0 votes
1 answer

Not getting a Valid JSON Respon from magento2 custom API

I am trying to return the collection factory from database , it is giving an array now i convert it to json using JSON Encode function but it is returnig a string with backslashes !! Code for Api ...
Syed Hassan Zamir's user avatar
0 votes
4 answers

Return JSON response instead of JSON String

I am working on building REST API which will return data of regions. API is working as expected but problem I am facing is, it is returning response with JSON string and not able to parse that. Would ...
anonymous's user avatar
  • 3,724
0 votes
0 answers

Replace <div> of page with <div> comes from $.ajax response

Problem is written inside the success section. $.ajax({ url : 'path to file', dataType : 'json', type : 'POST', data: data, success : function(res) { // here I want ...
Muhammad Ali's user avatar
0 votes
1 answer

How to set content-type header as JSON in controller Magento 2.3

I am having the controller which is responding with resultJson(\Magento\Framework\Controller\Result\JsonFactory), I have given setData. And I need to set header as JSON. I want the JSON result in the ...
SUBBULAKSHMI G's user avatar
0 votes
1 answer

How to send 'alert' from controller in json?

I am currently trying to stop redirecting to product view page if someone forgets to select configure option and click on 'add to cart', instead of that it will just send popup message or alert. Here ...
Sagar Parikh's user avatar
1 vote
0 answers

In Magento 2.3, How to add custom error code with response

In Magento 2.3, How to add custom error code along with response. For example, If I add the code as below, I am getting this below response: throw new InvalidEmailOrPasswordException(__('Invalid ...
Saravanan DS's user avatar
  • 1,118
0 votes
2 answers

Magento1.8 - Restapi Custom Module - Return variable formatting issue

This is my first post so please let me know if I missed sharing any detail on my problem. I have below files ready in Magento kept in app/code/community: A. Autogen > Restapi > etc > api2.xml B. ...
Ashish's user avatar
  • 11
2 votes
4 answers

How to use \Magento\Framework\Controller\Result\JsonFactory for Magento 2.3?

This post is related to this Magento2 - How to get JSON response from Controller What I am trying to do is to format the json response of my custom web API, but it seems \Magento\Framework\Controller\...
fmsthird's user avatar
  • 4,552