Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [json]

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

1
vote
0answers
962 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
205 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
278 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
295 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
805 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
85 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
35 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
2k 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
58 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
374 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
881 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
343 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
321 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
1k 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
763 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
660 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
523 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 ...
0
votes
2answers
823 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
352 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
4k 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
172 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
434 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 ...
4
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
71 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
506 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
48 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
257 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
750 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 = ...
1
vote
3answers
4k 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']...
0
votes
1answer
77 views

How can I get image url with product data in one json file?

public function productDataToJson(Varien_Event_Observer $observer) { $array = array(); $products = Mage::getModel('catalog/product')->getCollection(); foreach ($products as $_product) { ...
0
votes
3answers
127 views

Not getting product image urls of all products in json file?

public function productDataToJson(Varien_Event_Observer $observer) { // $product = $observer->getProduct(); $products = Mage::getModel('catalog/product')->getCollection(); foreach (...
0
votes
4answers
332 views

How to write function for getting subcategories of particular category?

function productDescription() { $_helper = Mage::helper('catalog/category'); $category = Mage::getModel('catalog/category')->load($categoryId); $_categories = $category->...
2
votes
2answers
467 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
2answers
2k 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:...
4
votes
4answers
5k 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(); ...
0
votes
1answer
97 views

Parsing JSON with PHP

How do I parse this JSON with PHP: a:6:{s:15:"info_buyRequest";a:6:{s:4:"uenc";s:148:"...
0
votes
0answers
106 views

How do I get two attribute values in same json file?

function productDescription() { $attribute = Mage::getSingleton('eav/config') ->getAttribute(Mage_Catalog_Model_Product::ENTITY, 'size'); if ($attribute->usesSource()) { $options ...
0
votes
1answer
269 views

How to save key value pair of array from JSON in magento 1.9?

Here is my test code trying to save data what I am getting in request, but it is not saving in table. $json = '{ "isMobileConfirm":false, "cid":"85036", "managerid":"12345", "location":...
0
votes
0answers
392 views

Jsonp getting internal server error

I tried to update the order status using an external app file the process in Magento file execute successfully that I can update the order status but the issue in jsonp I get false function here is my ...
1
vote
1answer
800 views

Magento 2 API - declare @return JSON

I'm playing with M2 API. I built a test module that returns specific Order items in JSON format. I set @return as 'string' (see screenshot below). Problem: I'm getting error: Class string does not ...
1
vote
1answer
631 views

Magento Patch 9767 “Decoding failed: Syntax error” [closed]

I am running EE 1.14.0.1 and PHP 5.6 and got below error on production server only. I cleared the cache and implement the solutions suggested by @folektoras133 at Security Patch SUPEE-9767 - Possible ...
1
vote
1answer
159 views

Add category description to “catalog/category_tree” collection

class Ab_CategoryObserver_Model_Observer { public function updateTopMenuJson(Varien_Event_Observer $observer) { $_helper = Mage::helper('catalog/category'); $_categories = $...
0
votes
1answer
63 views

I am gettig all my catagorries and subcatagories in json string,but I want only active catagories in my json string

class Ab_CategoryObserver_Model_Observer { public function updateTopMenuJson(Varien_Event_Observer $observer) { $_helper = Mage::helper('catalog/category'); $_categories = $_helper-...
1
vote
1answer
184 views

something is wrong in the code. theows an error->getNodeChildrenData() must be an instance of Varien_Data_Tree_Node,on line 18 [duplicate]

<?php class Ab_CategoryObserver_Model_Observer{ public function updateTopMenuJson(Varien_Event_Observer $observer){ $_helper = Mage::helper('catalog/category'); $_categories = $...
0
votes
2answers
81 views

What to do exactly? my code throw an error -> 'Call to undefined function getNodeChildrenData()'

class Ab_CategoryObserver_Model_Observer{ public function updateTopMenuJson(Varien_Event_Observer $observer){ $_helper = Mage::helper('catalog/category'); $_categories = $_helper->...
2
votes
3answers
6k 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 ...
1
vote
1answer
447 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 ...