Questions tagged [json]

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

Filter by
Sorted by
Tagged with
0 votes
0 answers
18 views

Magento 2.4.6 calling createOrder() causes exception with elasticsearch

In one of my scripts, calling createOrder() ( from vendor/magento/module-sales/Model/AdminOrder/Create.php ) causes an exception: {"error":{"root_cause":[{"type":"...
jonny5556's user avatar
1 vote
3 answers
163 views

Facing issue in composer.json file for an extension

I have mentioned in my one of extension in composer.json. Could anyone tell what does it mean. I think it means that the php version should be greater than 7.4.0 but less than 8.2.0 but when i ...
Tisha Jhanwar's user avatar
0 votes
2 answers
1k views

Magento upgrade error 2.4.5 in php 8.1 json_decode(): Passing null to parameter #1 ($json) of type string is deprecated

I am facing after an issue after upgrading version magneto 2.4.2 to 2.4.5 When I run this command I got error json_decode(): Passing null to parameter #1 ($json) of type string is deprecated app/code/...
Ravindrasinh Zala's user avatar
0 votes
1 answer
330 views

Magento 2 pwa FetchError: invalid json response body at https://xxx/graphql reason: Unexpected token c in JSON at position 0

Magento 2 PWA When we run the command "yarn run watch" then getting this error on the console - FetchError: invalid json response body at https://xxx/graphql reason: Unexpected token c in ...
sumeet bajaj's user avatar
  • 1,296
1 vote
1 answer
170 views

In Magento2 How do i solve this JsonSerializable error

When we open frontend at that time below error is generated. During inheritance of JsonSerializable: Uncaught Exception: Deprecated Functionality: Return type of GeoIp2\Model\AbstractModel::...
Sutariya Parth's user avatar
0 votes
1 answer
369 views

update product custom attribute API JSON format

I was using the postman to send post request. I have a single json payload send to API endpoint, which is success rest/default/V1/products/ { "product": { "sku": "203-...
Paul Fan's user avatar
  • 658
0 votes
1 answer
171 views

How to modify custom attribute of a product with JSON (Postman) Magento 2

thank you for reading me. Is there a way to modify a product´s custom attribute? I´m using postman, i use JSON POST for price and stock but i can´t find the way to update a custom attribute of a ...
Javier's user avatar
  • 1
2 votes
4 answers
12k views

Magento 2. Uncaught SyntaxError: Expected property name or '}' in JSON at position 1

I need help. In Chrome console I receive Error. I don't know where to look for the error and how to fix it. Uncaught SyntaxError: Expected property name or '}' in JSON at position 1 at JSON.parse (<...
Tom's user avatar
  • 87
1 vote
1 answer
121 views

getting Js error in google analytics code

We are using google analytics in our website but getting below error in console. Error: Uncaught SyntaxError: Unexpected token ':' Script: <script type="text/x-magento-init"> { &...
Arti patel's user avatar
0 votes
0 answers
100 views

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
  • 51
2 votes
1 answer
227 views

Custom renderer showing only the last item from an array into grid magento2

I am trying to show all of the postal codes in my grid from the array in column but it showing only the last one. Array ( [0] => Array ( [from_postalcode] => 123 ...
BodrinSanfu's user avatar
2 votes
1 answer
201 views

Why are so many numerical parameters in JSON are of string type?

I've been looking at the examples in the documentation and also issuing GET requests via REST to get various information about products and categories. One thing that I find unusual is that there are ...
Захар Joe's user avatar
3 votes
1 answer
1k views

Magento 2 How to return JSON object in rest response

I want to return the JSON response suggested by the mobile app developer. My custom rest API currently returning responses in the below format. [{ "status": true, "data": [ { ...
savita nagdev's user avatar
0 votes
2 answers
23 views

Can't load any data in backend

I've a (random ?) <pre> added in the end of the default json rendering content in backend (for users, products...). I'm sure I didn't touch anything from this part of the website, any ideas ?
Morgan Tartreau's user avatar
0 votes
3 answers
692 views

Magento 2: db_schema_whitelist.json

What is the main usage of db_schema_whitelist.json file ?
Jaydeep. A. Pandya's user avatar
0 votes
1 answer
199 views

JQMIGRATE: jQuery.parseJSON requires a valid JSON string

I am facing JQMIGRATE: jQuery.parseJSON requires a valid JSON string this error in console log on Aheadworks store locator, please if you know about this issue kindly tell me solution. NOTE: ...
Zahid Hussain Magento's user avatar
0 votes
3 answers
398 views

Magento2 convert html to either array or json

Magento2 How can I convert html ul li list that I got from CMS block into Json or array format? Can someone please guide me on that?
Arjun's user avatar
  • 3,586
0 votes
1 answer
208 views

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
1 answer
865 views

array_search() PHP fucntion not working on array

I am unable to have the array_search() working. I have a string from an API call in a variable $myresp [{"name":"product 1","order_id":1,"product_type":"...
user2478262's user avatar
0 votes
1 answer
260 views

Magento 2 API Order Items, convert Json to table using php

I am tring to create a table dinamically with the products of a Magento order using API result. I have the following PHP code to dinamically generate a table with Json content $data = json_decode($...
user2478262's user avatar
1 vote
1 answer
811 views

Magento 2 knockout js use JSON array inside JSON object

Js Code : getRowData: function() { return window.checkoutConfig.row_data; } Knockout Code : <!-- ko foreach: { data: getRowData(), as: 'rowdata' } --> ...
Vikas kalal's user avatar
  • 1,271
0 votes
1 answer
399 views

Generate Json file after order is confirmed

I need to generate a Json file containing information about Order just right after a customer finish his checkout and the order is generated in admin using orderIdThis json file will contain data ...
Jad's user avatar
  • 3
1 vote
2 answers
805 views

Add collection filter from json field

I want to filter custom collections with JSON field filters. In the below image, there are 2 fields category and product. They have JSON value. I am able to get collection by Direct SQL query by ...
Banna Online's user avatar
  • 1,059
0 votes
1 answer
111 views

First product added to new cart returned with no JSON "price"

This is my first time currently working with Magento. I am developing a custom web shop solution for a machine shop with React.js. My issue is the following: After having completed a purchase and ...
Nikolaj Hem's user avatar
0 votes
1 answer
388 views

How do I use unserialize method instead of json_decode

How do I use unserialize method instead of json_decode, by inject vendor/magento/framework/Serialize/Serializer/ foreach ($results as $result) { $incrementId = $result['increment_id']; ...
Paul Fan's user avatar
  • 658
0 votes
0 answers
395 views

Debugging Error while translating phrase “%s” in file %s. in Magento 2.3.5-P1

I'm currently building a site with Magento 2.3.5-P1 (installed via composer) I've added a theme (Porto) and a small number of 3rd party extensions I've just noticed that on the product pages there is ...
Tony Ryan's user avatar
2 votes
2 answers
322 views

JSON request to controller giving error invalid form key

I have a custom module with a button in the admin that i want to call a controller class on click. My phtml file contains this JavaScript : <script type="text/javascript"> require([...
gazZz's user avatar
  • 97
0 votes
2 answers
927 views

How to convert Json object to an associative array?

Building an associative array from json object is necessary when making an API call to Walmart. Could anyone please help me get the associative array from this object? { "orderShipment": { ...
CodeForGood's user avatar
2 votes
1 answer
357 views

How to Get Base Url in Theme Custom JS file and how to return response in JSON format?

I have created a module in which all the things is done just 2 things are remaining . How to add Dynamic base url in Magento 2 theme JS file. ex : http://127.0.0.1/projectname how to get that ...
Prits's user avatar
  • 625
2 votes
1 answer
357 views

Can not save in db custom json value on block

In my plugin I created a new table 'myapp_staging' made of three columns: 'id', 'id_api_call' and 'f24_options_value'. In the last field I would like to save a response to my Api call in json format. ...
Davide Iandoli's user avatar
2 votes
1 answer
2k views

rest api magento 2 get attribute code by attribute id

I need to get the attribute code by attribute id with rest api. This is needed for configurable product. I get the configurable product data: "extension_attributes": { "...
blob's user avatar
  • 455
0 votes
1 answer
982 views

Magento 2.x knockoutjs dispaly data from observable Json Object

to display data from observable array one can do: Component: myObject: ko.observableArray([{name: 'test'}]), Html: <ul data-bind="foreach: myObject"> <li data-bind="text: name">&...
Juliano Vargas's user avatar
0 votes
2 answers
342 views

script error composer.json

I want to add 3rd party module from artifacts in my project. required all modules with composer but when I run composer update at the end I have following error Fatal error: Uncaught LogicException: ...
Giga Todadze's user avatar
1 vote
4 answers
10k views

how to properly serialize / unserialize magento 2 models to json format

I'm trying to retrieve some data from a controller in a serialized format that I can unserialize later. For example, I have created an entity with the following data fields MyEntity entity_id ...
gabtzi's user avatar
  • 656
0 votes
1 answer
153 views

Sum of id element from n number of array inside array in PHP

I have an array like tree and i want to get sum of id element any idea how to get?? Thanks <?php $data=[ 0=>[ 'id'=>1, 'date'=>'3/3/...
Binit Kumar's user avatar
0 votes
1 answer
494 views

Magento 2.3 How to convert JSON response array to array of same type object REST API

I have created a custom api to get review and rating summary: public function getRatingSummary($productId) { $result =[]; $product = $this->_productRepository->getById($productId)...
Adrian Joseph's user avatar
0 votes
1 answer
1k views

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
2k views

How to implement rich results in magento 2?

Basically I am trying to add structured data such as AggregateRating for products with reviews, Offer – price and priceCurrency, Image(s), SKU, Product name, as JSON-LD code in all products page in ...
J. Doe's user avatar
  • 259
0 votes
1 answer
574 views

How do I set up Magento 2.3.3 with a sandbox Auth.net account?

Using Magento 2.3.3, I've set up a sandbox Auth.net account, and added the API Login ID, Transaction Key, Public Client Key and Signature Key to the admin configuration, enabled the Payment Method and ...
dbcn's user avatar
  • 754
0 votes
2 answers
1k views

Magento2.3: How to create a CSV and JSON file?

I have successfully got the wishlist collection of customer by referring the below link: https://www.rakeshjesadiya.com/get-wishlist-collection-of-customer-by-customer-id-magento-2/ Now, I have to ...
Mohammad's user avatar
0 votes
0 answers
81 views

Json does not exist for my custom module

Vendor name: SimplifiedMagento Module name: MilkyMan Class SimplifiedMagento\\MilkyMan\\Serialize\\Serializer\\Json does not exist" This thing is coming when i am loading my home page.
Ankur Anand's user avatar
0 votes
1 answer
169 views

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
2 votes
0 answers
237 views

Magento 2: GraphQL V/S REST API [closed]

I am planning to build API's. Which is better GraphQl or REST API? How easy to customize either as per the developer perspective view? https://www.howtographql.com/basics/1-graphql-is-the-better-...
Jackson's user avatar
  • 9,909
1 vote
0 answers
252 views

Magento 2.2(checkout page): Uncaught SyntaxError: Unexpected end of JSON input

I have read other posts here in this forum but I am having a hard time finding the solution to my problem. On the checkout page, the shipping method does not show and is only loading forever. (we are ...
Vince Mendres's user avatar
0 votes
0 answers
155 views

Magento 2 JSON.parse: unexpected non-whitespace | and <pre> tag in json after json response in every APIs

show JSON.parse: unexpected non-whitespace | and tag in json after json response in every APIs; And tag is appending after tag in all front end and admin pages and also in ajax response ][send ...
Shahzaib Anwar Rehmani's user avatar
0 votes
1 answer
560 views

Magento 2 Get product options id for sql query

I have this query: SELECT * FROM `sales_order_item` WHERE `product_options` LIKE '%2010%' With the last bit being the decoded option id, I need to find two specific option ids to use inside this ...
Howliee's user avatar
  • 153
0 votes
2 answers
2k views

Magento 2 WebAPI json encode

I'm returning JSON via an endpoint in Magento 2 this bit of JSON looks like the following: $new_json = [ 'component_1' => '[{....}]', 'component_2' => '[{...}]' ]; ...
andy jones's user avatar
  • 1,383
0 votes
2 answers
28 views

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
1 vote
1 answer
105 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", "...
Kozame's user avatar
  • 964
2 votes
1 answer
369 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 ?
Shafeel Sha's user avatar
  • 1,395

1
2 3 4 5