We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [json]

This tag should be used for questions related to json data types

Filter by
Sorted by
Tagged with
23
votes
9answers
35k views

How to update magento2 from 2.0.0 to 2.0.2

The docs here say that you should use the system upgrade utility: http://devdocs.magento.com/guides/v2.0/comp-mgr/upgrader/upgrade-start.html and do it from the admin. I thought that you would be ...
10
votes
1answer
1k views

Magento2 : API Stock update

Using Magento 2.2.2, I was trying to add stock updates to a pre-existing setup using the official defined endpoint: rest/V1/products/testsku/stockItems/1 with { "stock_item": { "qty": 1234, ...
7
votes
4answers
20k views

How do I get a response from REST API in JSON format in Magento 2?

I used the resources in “Creating a New REST Web Service in Magento 2” and “Creating a New REST Web Service in Magento 2” to create a custom API module, but the response is in XML format. I need a ...
7
votes
4answers
2k views

Creating a custom module to send order details to external supplier API via XML or JSON

I'm trying to write a custom module for Magento that when certain items are ordered and payment has been made, posts to our clothing supplier's site with details of the ordered item, delivery address ...
6
votes
2answers
1k views

Magento 2.3 use of `db_schema_whitelist.json` file in etc directory of each module

What is the use of db_schema_whitelist.json located in Magento Catalog etc directory? In Magento 2.3 version, I found db_schema_whitelist.json and db_schema.xml files, in the Magento_Catalog module. ...
5
votes
3answers
22k views

Magento2 - How to get JSON response from Controller [closed]

I've created my custom controller and I want to return the result formated with JSON. I always get a JSON parse error "JSON.parse: unexpected character at line 1 column 1 of the JSON data" and the ...
5
votes
3answers
4k views

how to create grid using ui component with multi table(JOIN) in magento2?

I have created a grid with UI component with one table now I want to join another table so how can I create?? i try but not working in Vendorname\Modulename\Model\ResourceModel\Quote\collection.php ...
5
votes
4answers
6k views

Magento 1.9.3.3 - How do you return a JSON array from a controller to ajax

I have a ajax call to a controller (suburbSearchAction) which retrieves a list of suburbs based suburb text received from the user Ajax call inputSuburbData = jQuery(inputSuburb).val().trim(); ...
4
votes
3answers
3k views

No response from POST to custom REST Api route

I set up a working custom route for Magento's REST Api. It works fine for GET requests, as the _retrieve() function of the corresponding V1.php class is being called as expected and returns the data. ...
4
votes
2answers
1k views

Magento 2 - How to get JSON response from Controller

I've created my custom controller and I want to return the result formated with JSON. I always get a JSON: [] Route: <route url="/V1/points/get" method="GET"> <service class="module\...
3
votes
3answers
2k views

How to get json data on frontend controller in magento2?

<?php namespace Vendor\Module\Controller\Index; class Index extends \Magento\Framework\App\Action\Action { protected $resultPageFactory; public function __construct( \Magento\...
3
votes
1answer
69 views

How to avoid using php://input?

I have a POST endpoint that receives a JSON payload. I'm using the Magento\Framework\App\Request\Http class to try and retrieve my POST data. If I run $data = $this->request->getPost();, ...
3
votes
1answer
870 views

how i update the order status in controller in magento 2?

<?php namespace Vendor\Module\Controller\Index; use Magento\Framework\App\Action\Action; use Magento\Framework\App\Action\Context; use Magento\Framework\App\ResponseInterface;class Index extends ...
3
votes
1answer
1k views

Magento 2: Intercept controller's JSON response

I'm trying to intercept a controller returning a JSON object of Magento\Framework\Controller\Result\Json class. The problem is that no matter if I use a plugin or a preference to "catch" the ...
3
votes
2answers
3k views

Price not updating on Configurable products after upgrade to Magento 1.9.3

I think I may have found a bug in Magento CE 1.9.3 which was released last week? I upgraded our Staging environment to it and have found that the pricing of Configurable products is not updating ...
3
votes
0answers
31 views

Magento 1.9 - How to get JSON config by a bundle item id in cart?

When I have a bundle product in the cart, I can edit it by clicking the edit button . At this point, a page with the product to edit will be loaded. Also, a function named "getJSONConfig()" will be ...
3
votes
1answer
334 views

Magento 2 Unexpected number in JSON at position 1

Am working on magento 2.3 and have an error in console product page,i have no idea what is it,i guess its fetching json data with error in product gallery part. I tried every thing like clearing ...
3
votes
1answer
427 views

How to pass a json data from Observer to phtml

Upon Login, I am sending an API call(post request) to an external site in observer which return a JSON response. I need to populate a table in the phtml with the response received. Hence I am trying ...
3
votes
0answers
436 views

Reset super-attributes in select drop down for configurable products [closed]

Currently I have 2 select options: size and color as dropdown menus for my configurable products. On the frontend, users can select size, then color. Options for color are greyed out accordingly if ...
2
votes
2answers
2k views

Alphabetically Sort The State/Province Drop Down

I have an issue in sorting alphabetically those items in the state/region drop down. // File: Mage/Directory/Helper/Data.php (line:150) $json = Mage::helper('core')->jsonEncode($regions); Mage::...
2
votes
3answers
837 views

I have one json file of all products, and now I want to display only those products of current categories?

$baseUrl = $this->getBaseUrl(); $skinUrl = $this->getSkinUrl(); $currcategory = Mage::getSingleton('catalog/layer')->getCurrentCategory(); $products = file_get_contents('c_node.json'); $arr = ...
2
votes
3answers
7k views

Magento2: How to convert JSON to Array of nested objects

I am wanting to understand if there are some functions in Magento Framework which will assist me in mapping an array of nested objects from JSON (such as what would happen when the REST API is ...
2
votes
2answers
5k views

Force JSON Encode to Return Object

As far as I understand, Magento has a JSON encode function by using zend framework. And my question, is there an option to force that function always return JSON object, not JSON array? Mage::helper('...
2
votes
2answers
70 views

Magento1.9.4: Images Not Uploading in Admin – JSON in Syntax Error

I am trying to upload an image - something which I have done a hundred times. Now it gets stuck with "uploading..." showing. I have tried disabling extensions. I haven't made any changes. There have ...
2
votes
1answer
360 views

How can I get the value of array object?

Im try to pass sql query value as an AJAX request, It have a array object I need to pass only the value, below code for that public function execute() { $resultJson = $this->resultJsonFactory-...
2
votes
1answer
5k views

Properly convert Magento's returned object to JSON

I made a customer log-in to the site programmatically... I am properly returned the session values in form of an object. Now i want this data carried over and returned from the function in JSON ...
2
votes
1answer
70 views

Get current Logged user Wishlist products id in Ajax Call Magento 2.3

I Want currently logged user all wishlist products id's json array via ajax call ?
2
votes
2answers
125 views

How to overwrite .php file of lib directory?

Any one tell me how i can overwrite this file in magento 2.3 Path: Magento2\lib\internal\Magento\Framework\Webapi\Rest\Response\Renderer\Json.php
2
votes
1answer
968 views

Magento 2: how to debug json error

After a while of developing (with a colleague) I get this JS error on every page: "SyntaxError: JSON.parse: unexpected character at line 5 column 50 of the JSON data" in file main.js. This is nice to ...
2
votes
1answer
2k views

Magento 2 - Send processed data from Controller to PHTML

I am working on a simple custom module, where the user can input height and the weight/BMI will be shown as output on form submit. On clicking the submit button user will be redirected to different ...
2
votes
1answer
126 views

Move HTTP GET request into a JSON array in Magento 2 REST API (V1/customers/search)

Is it possible to put the content of this rest api in a json array to put in GET parameters instead ? And if yes, what should the code look like ? curl_init("http://my.website.com/index.php/rest/V1/...
2
votes
2answers
549 views

Serialized array in controller

This is my script <script> function callAjax(){ var customoptionhtml = document.getElementById("customoption-dynamic").innerHTML; //alert(test);//alert(jQuery(test).text()); var ...
2
votes
1answer
2k views

KnockoutJS cannot read property 'fromJS' of undefined

I have tried bind json file with knockoutjs into my custom template. But i got this error in browser console: Uncaught TypeError: Cannot read property 'fromJS' of undefined How to avoid this error?...
2
votes
1answer
2k views

Format Cart Totals HTML from JSON Response

My Controller File public function myAction() { $response = array(); $response['myresponse'] = $this->myAjax(); $this->getResponse()->clearHeaders()->setHeader('...
2
votes
0answers
210 views

Magento 2.3.1 JSON.parse: unterminated string at line 2 column 1009

I am unable to set payment method in Magento 2.3.1. As soon as I click on the payment method button all JavaScript functions are killed. open error log nothing to show, but browser console point me ...
2
votes
1answer
79 views

JSON API “website_id” in tier price create

I've already got products and stock updates going back and forth via the JSON API, and I'm now working on orders and prices for each store view - each one has a different currency, therefore different ...
2
votes
0answers
101 views

Magento 2: Is there a way to return custom json response from REST API without building a data interface?

I have a few custom REST API interfaces on my module & they all need to return a standard json response (different on each). After a little research, I realized that I can't do something like @...
2
votes
0answers
237 views

How to find Magento version using API (JSON specifically)

Using the JSON RestAPI, I need to do things slightly differently depending on the version of Magento due to as-yet un-fixed bugs (specifically https://github.com/magento/magento2/issues/18005). I can ...
2
votes
1answer
1k views

Magento 2.2.2, Unable to unserialize value, magento_umask and edting Json.php did not help

After upgrade I'm getting below error in my local : Exception #0 (InvalidArgumentException): Unable to unserialize value. #0 myPath/vendor/magento/module-theme/Controller/Result/MessagePlugin.php(...
2
votes
2answers
3k views

Magento 2 how to unserialize backend config

I've created Magento 2 module that saves a particular configuration. Screenshot: Now I want to use this value in a frontend block. If I check the core_config table, the value is saved like this: a:1:...
2
votes
2answers
492 views

how i get the json body in controller in magento 2?

<?php namespace VEndor\Module\Controller\Index; class Index extends \Magento\Framework\App\Action\Action { protected $resultPageFactory; public function __construct( \Magento\...
2
votes
1answer
38 views

Quickcreate JSON error

Using the quick-create-product option on Configurable Products gives an error. An AJAX call is made, the product is created but the JSON response is wrong. So the 'Please wait' overlay stays and the ...
2
votes
1answer
582 views

Why doesn't Magento setHeader('application/json') when appropriate in OnePageCheckout?

I have a Magento environment that is tunneled through Apache via mod_proxy. During the one-page checkout process, Apache is erroneously wrapping JSON responses in HTML because the response header says ...
2
votes
0answers
124 views

curl and json approve conversion Rest API

i'm currently coding a little api for extole approve conversion api. It's only suppose to send data on declined orders which is equal to cancelled in the magento admin. Here is what i have written ...
1
vote
3answers
5k views

“Zend_Json Decoding failed: syntax error” when submitting order

I recently switched from Apache/PHP 5.5 to a new nginx/PHP 7.0.4 server and now I am getting once in a while a "Decoding failed: Syntax error" when customers try to checkout, apparently when they ...
1
vote
1answer
29 views

Custom API POST JSON

I created a custom API REST : https://domain/rest/V1/action This is a POST request, with JSON in the body. Example : { "my_test_here": [ { "first_field": "value1", "...
1
vote
1answer
258 views

js-translation.json fails to generated

Magento 2.1 We have a site setup with both English and French languages. We were noticing some french translations weren't showing on checkout page. Upon further inspection js-translation.json was ...
1
vote
1answer
516 views

Magento 2: How can I store my original REST request in a file on the server?

I need to store my REST request within the file system - I have tried serializing the request object, but obviously the file size is quite a lot larger than the original. I have run a test that ...
1
vote
1answer
273 views

How echo json data in a Magento controller on a valid way?

I have created a Magento plugin. In this plugin I call (with ajax) a custom controller where I echo some json data: public function testAction() { echo json_encode('test'); exit; } But when I ...
1
vote
3answers
6k views

How can i get image url with proper path?

<?php foreach ($temp as $product): ?> <?php $id = $product['entity_id']; $img = $product['image']; $url = $product['url_path']; $small_image = $skinUrl.$product['small_image']...