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

0
votes
1answer
18 views

Multiple For each loop value to Json string

$data= array(); foreach($itfdatas as $key=>$itfdata){ $checkemps = explode(',',$itfdata['employee_id']); $data[] = array( 'id'=>mysql_real_escape_string($itfdata['P_id']), ...
2
votes
0answers
31 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 ...
0
votes
0answers
24 views

I can not unserialize this string

I have saved this string into the database. when I trying to decode this string by below sentence this does not working. \Magento\Framework\Serialize\Serializer\Json $serializer $this->...
2
votes
2answers
98 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
1
vote
0answers
18 views

How to display a popup on the product page at the touch of a button, add to the basket? Magento 2

There is an event that checks if the goods in the basket when we go to the product page. If there is an attribute in the goods that allows to deliver the goods on the day of the order, if this ...
0
votes
1answer
55 views

Magento 2.3 REST API Json response format issue

How I can change the json format from [ [ { "success": [ { "code": 200, "response": { "...
1
vote
0answers
45 views

Ajax call always returns in error from controller Magento 2

From my controller, I return a JSON data to my Ajax call but it always goes in the error section, even when it's not an error. jQuery.ajax({ type: 'POST', url: '/yxcustomer/index/...
3
votes
1answer
55 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
53 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 ...
1
vote
1answer
40 views

Magento 2.3 - Get child categories of parent

In Magento 2.2 I've written this little script. /** * Index constructor. * * @param Context $context * @param StoreManagerInterface $storeManager * @param ...
1
vote
1answer
30 views

Create order data json file in root after checkout is completed

I want a json file of order data to be created in root directory after the checkout is completed. I have been searching this for hours now but still luck.
0
votes
1answer
25 views

Get product info in JSON/XML without authentication

Is it possible to get product info in JSON/XML format without using any authentication from a website using Magento. For example, Shopify provides product's info as https://mystore/products/product-...
0
votes
0answers
82 views

Product detail page image not loading on front end

Product detail page images are not loading. Pointer is just spinning. I have read lots of threads. Clear cache, reindexed, change permissions. Finally i got the problem. but unable to fix it. :-/ I ...
2
votes
1answer
17 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 ...
1
vote
0answers
16 views

How to retrieve the JSON string inside a controller and convert it in an array?

I have a controller that returns a JSON on the page. This is the code //Above in the code injection of \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory $result=[ "orderId" ...
3
votes
2answers
281 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. ...
1
vote
0answers
45 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 @...
0
votes
1answer
19 views

Could a hybrid data model, like using JSON in fields, allow us to eliminate the need for EAV within something like magento 2?

I was reading about EAV, and what options are available to avoid the pain caused by it, and stumbled upon using JSON in fields. This mariadb feature page shows an example like, SELECT name, ...
3
votes
1answer
216 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 ...
0
votes
0answers
470 views

Response to preflight request doesn't pass access control check

There are many questions about "Access-Control-Allow-Origin" which I applied in htaccess as follows Header set Access-Control-Allow-Origin "*" After applying that I am facing following error: ...
0
votes
0answers
18 views

Loading default image failing with quote in name

I have several product in my store. Some of them have no image and have quote in the name Example of name: My product "a detail" This is causing this issue : SyntaxError: JSON.parse: ...
1
vote
2answers
347 views

Magento 2, addAttributeToSelect not working with product collection?

I am applying these fillers: $collection->addAttributeToSelect('name'); $collection->addAttributeToSelect('sku'); but every time getting full record as comes form: $collection->...
0
votes
2answers
85 views

Magento2, How to pass product data as query string in Url using JSON template? Custom Module

I am trying to get product name, product SKU, Quantity in Url such that when I write 1 in Url 1-50 products should display, when writing 2 as page number 51-100 products should display. And data goes ...
1
vote
1answer
204 views

Magento 2 jsonParse() does not receive data, Unexpected token '

I'm creating a js template in Magento 2. When I call js, I get an Uncaught SyntaxError: Unexpected token 'in JSON at position 96. Why jsonParse () does not get the value? Can somebody help me? file ....
1
vote
0answers
209 views

How to add a new attribute in order response json in get order api

I have added a new column "old_order_id" in sales_order table using upgradeSchema. Now, I need to set that "old_order_id" through API. So, how to add that attribute(old_order_id) in request json ...
1
vote
0answers
30 views

Product images in multiple stores using JSON API

I have four stores created, and I'm trying to upload a single image for the same product in each of the stores. My issue is that to get an image to show in the category front end view, I need to ...
2
votes
0answers
133 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 ...
0
votes
1answer
43 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
24 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
120 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
147 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
146 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
145 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 ...
8
votes
0answers
764 views

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
183 views

Edit widget in CMS page Magento2

I have a widget added in my CMS page like this. It is added by default from a theme I purchased. How can I edit this JSON encoded widget as Magento is not able to filter out products. {{widget ...
0
votes
0answers
401 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
692 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
358 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
310 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
554 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
1k 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
276 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
755 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
513 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
122 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
119 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
192 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
940 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
194 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
265 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, ...