Questions tagged [json]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
47 views

What is the Composer.Json file and what is it used for?

I would like to know what the composer.json file is actually used for when I create a new module. I know it's an optional file that can be created when I create a new module so why include it? ...
0
votes
1answer
26 views

Magento 2.2.4 Unable to unserialize the value

I'm trying to import products with CSV programmatically and getting following error on update some product. I tracked down issue and only one thing which I know - all products returns JSON encoded ...
0
votes
2answers
160 views

Uncaught Type Error in magento 2 and 404 error

I've been attempting to set up Magento 2 on a WAMP server and have ran into a few errors. My Magento UI doesn't look right and I have 2 errors in the error log (When you F12 the page). "Uncaught ...
0
votes
1answer
160 views

JSON Response parse error from controller

Magento 1 - I keep getting a parse error. I can't figure out where my syntax is wrong. $this->getResponse()->setHeader('Content-type', 'application/json'); $this->getResponse()->setBody(...
0
votes
1answer
239 views

Magento2: How to correctly render a json in grid field

I created a field in my order grid table, I have an observer set up that will fill the field with a JSON string of the ordered items. I want to have this field rendered to HTML so the ordered items ...
1
vote
1answer
252 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 ...
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, ...
0
votes
0answers
477 views

Magento 2: Can't complete checkout because of unexpected character of the JSON data

After filling the shipping information in the first step of checkout, I click on the "Continue" button and the site stops responding. The spinning wheel appears but it is not possible to click on ...
2
votes
1answer
962 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 ...
1
vote
1answer
590 views

Magento 2.2. Get error with ''@param string[] $types' in REST API

Using magento 2.2. I create rest api for edit address which need pass param in 'array of string' but i get an error: Doc: Magento Configure services as web APIs Used array of string for pass param ...
0
votes
1answer
356 views

List all Guest user's Order History in magento 2?

Create a Magento 2 extension to implement guest order history feature. Please implement with a new controller that takes parameter(s) to query a single order and returns a json with information about ...
0
votes
1answer
821 views

Magento2 : Zend_Json_Exception : Decoding failed: Syntax error in Magento 2

I have a custom module which is working perfectly in my local machine but while I am trying to enable my module in my magento 2store hosted in cPanel, I am getting below error > bbcmanagement@...
1
vote
2answers
2k views

Magento2 Uncaught SyntaxError: Unexpected token B in JSON at position 121

Product detail page showing this error for some products Uncaught SyntaxError: Unexpected token B in JSON at position 121<br> at JSON.parse (<anonymous>) at getData (main.js:58) ...
1
vote
1answer
406 views

Magento get all products details in json format

I am using magento 1.9.3 version. I got the specific products details in json format. Now i want show all the products details in json format. I referred some more sites, There is not examples of ...
1
vote
3answers
1k views

How to list all products from API with curl command line?

I've been trying a lot of things and can't seem to figure out what should be pretty simple... How can I make a request with curl in command line to /index.php/rest/V1/products so that I simply get the ...
0
votes
1answer
608 views

return array of json after call ajax magento 1.9.3.x

I have create a search bar for search zip code for storelocator. So in my code, i have create a request ajax who send param of zip code : jQuery(document).ready(function(){ jQuery("#searchzip")....
0
votes
2answers
180 views

How to set the json response in to dropdown in magento 2

I got a json response for a dropdown field from a controller, But how to I append the options to the dropdown, Please provide me a solution. I got response like below. {"content":[{"value":"210","...
0
votes
2answers
187 views

how to fetch all order items through loop from json data api ? magento2

Hi i have an array coming from json data of placed order items in my api in this form. let's suppose this example : [items] => Array ( [0] => stdClass Object ...
0
votes
1answer
258 views

Send JSON response from Magento\Wishlist\Controller\Index\Add controller in Magento 2.2.2

I am trying to override Magento\Wishlist\Controller\Index\Add controller's execute() method to return a JSON response. I have created a after plugin for it. Vendor\Company\etc\frontend\di.xml: <?...
1
vote
0answers
1k views

Magento2: SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

The above code written in catalog_product_view.xml in module-catalog. For this block, customer info in header after login not loading. In console I'm getting this error: SyntaxError: JSON.parse: ...
1
vote
1answer
258 views

How to append a new Json element to setData with resultJsonFactory in Magento2

public function __construct( JsonFactory $resultJsonFactory ) { $this->resultJsonFactory = $resultJsonFactory; } $response = $this->resultJsonFactory->create(); $response->...
0
votes
1answer
303 views

Pass the magento data to json

I need a small help. How to pass the values to json with different values. $params = array( 'OrderLineId'=>$orderLineId, 'MaterialNo'=>$materialNo, ...
0
votes
1answer
334 views

REST API vs JSON

I've found lots of questions and answers on REST API vs SOAP API. Some of them like this one mention JSON. Could you explain what is the difference between REST API vs JSON. (aka create custom ...
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(...
1
vote
2answers
99 views

Jquery post request returning html

I am trying to make an AJAX request in my Magento 2.1.8 custom module. The Http Post Request is returning all of the data i expect it to in JSON format, However it is also adding on some of my html ...
0
votes
1answer
40 views

How to get a document containing order details

How do I get a document for a specific order in Magento (1.x) and (2.x) if possible please. { "id": 100, "customer_id": 10, "date_created": "Wed, 14 Nov 2012 19:26:23 +0000", "...
0
votes
1answer
3k views

Convert model collection to json_encode

Currently I'm converting my collection data to json_encode like this: $collections = $this->modelFactory->create()->getCollection() ->addFieldToFilter('status','1'); $...
1
vote
0answers
59 views

Content Blocks Backend not loading

I'm not sure what caused this but out of nowhere my blocks in the backend of my Magento is not loading it sits there with a loading icon. https://imgur.com/a/9Osu2 I am also getting this error with ...
0
votes
1answer
498 views

Request Response JSON in magento 2

I have modified form review as popup modal and have overrides the controller in my custom module, the review saved successfully in DB. I need to pass the response to the to JS in JSON format , Help me ...
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\...
0
votes
1answer
991 views

Unexpected end of JSON input after cache cleaned

I am always getting an Unexpected end of JSON input error after clearing my caches cache:clean | cache:flush. But this error only happens on first page load. When I reload the page again it is gone. ...
0
votes
0answers
350 views

Unable to unserialize value - when adding to website magento 2.2

Migrated fine to 2.2. Now when we open a product and change text for example all works and saves. When trying to assign to another website we get the error Unable to unserialize value. Log shows: [...
0
votes
1answer
399 views

Get convert resultJsonFactory response to string in Magento2

I want to log the values of a resultJsonFactory object in php with in Magento 2: How do I get the values I set in the $response object ? $response = $this->resultJsonFactory->create(); $...
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 ...
0
votes
1answer
850 views

Show “You need to choose options for your item” message in magento2.2 when I hit API for add to cart configrable product

This is on Magento official document http://devdocs.magento.com/guides/v2.2/get-started/order-tutorial/order-add-items.html magento-host/rest/default/V1/carts/mine/items parameters { "...
0
votes
1answer
769 views

Magento 2 Json return from controller : Recoverable Error: Object of class

How can i pass json from controller. <?php namespace Swarming\FindProdFast\Controller\Index; use Magento\Framework\App\Action\Action; use Magento\Framework\App\Action\Context; use Magento\...
1
vote
1answer
660 views

Upgrade Magento 2 via composer not working

I try to upgrade Magento 2.1.6 to Magento 2.1.9. To do this I ran this command: composer require magento/product-community-edition 2.1.9 --no-update after this I ran : composer update and I ...
1
vote
2answers
1k views

How to create json file in magento 2

I need to create a json file with data and store that file in specific directory of magento 2. Can any one please tell me how we can achieve this in magento2 in standard way like file system. Please ...
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-...
1
vote
1answer
5k views

Javascript Object : How to Remove Square Brackets [closed]

I have this Js Obect, I need to trim/remove one set of square braces "the outermost ones [ ]" from the object . Below is the structure: [[{"id":"5","color":"red",nges":[{"monthindex":3},{"monthindex"...
-1
votes
1answer
40 views

Issue with getting json data

I want to get "scanDetail" array's 1st objects 1st element "Scan": Shipment Delivered details tracking:{ "Shipment":{ "@attributes":{ "WaybillNo":"69561350456", "...
0
votes
3answers
180 views

Compare data in database with jquery and json

Is it returning me error 500 syntax, does anyone see any errors? jQuery Code var ordertxt = $j("#ordertxt"); ordertxt.blur(function() { $j.ajax({ ...
1
vote
1answer
478 views

How to handle custom_attributes from REST API data?

When dealing with the Magento v2 API, I faced a problem where getting product details have inconsistent data from REST API. Example 1: Example 2: These are Note 8 and iPhone 8 data and we can see ...
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 ...
0
votes
3answers
1k views

How to solve this “Item (Mage_Catalog_Model_Product) with the same id ”5“ already exist” error

public function productDataToJson(Varien_Event_Observer $observer) { $categoryModel = Mage::getModel('catalog/category'); $treeModel = $categoryModel->getTreeModel(); $categoryIds = $...
1
vote
0answers
76 views

How to get every product's quantity in event observer json file?

public function productDataToJson(Varien_Event_Observer $observer) { $category = Mage::getModel('catalog/category'); $tree = $category->getTreeModel(); $tree->load(); $ids = $tree->...
0
votes
3answers
620 views

Magento 1.9 - How to get attribute labels on product model

public function productDataToJson(Varien_Event_Observer $observer) { $category = Mage::getModel('catalog/category'); $tree = $category->getTreeModel(); $tree->load(); $ids = $tree->...
0
votes
0answers
50 views

How do I get price value with currency, also size and color attribute value instead of id?

public function productDataToJson(Varien_Event_Observer $observer) { $category = Mage::getModel('catalog/category'); $tree = $category->getTreeModel(); $tree->load(); $ids = $tree->...
0
votes
2answers
323 views

How to fix Error: unexpected '​' (T_STRING), expecting ')' error?

How can I fix this error in my code: Parse error: syntax error, unexpected '​' (T_STRING), expecting ')' error Code: public function productDataToJson(Varien_Event_Observer $observer) { $...
2
votes
3answers
833 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 = ...