Questions tagged [json]

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

Filter by
Sorted by
Tagged with
0 votes
2 answers
15 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 ?
user avatar
0 votes
3 answers
61 views

Magento 2: db_schema_whitelist.json

What is the main usage of db_schema_whitelist.json file ?
user avatar
0 votes
0 answers
17 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: ...
user avatar
  • 120
0 votes
3 answers
35 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?
user avatar
  • 3,446
0 votes
0 answers
56 views

How can I pass custom form data and load result page using Ajax?

New to Magento. My goal with this is to have customer pick price range and sort order from a custom form I created, then when form is submitted have Ajax pass the form data AND load the new page with ...
user avatar
0 votes
1 answer
34 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 ...
user avatar
0 votes
0 answers
15 views

Menu tree via JSON and AJAX

I want to populate TOP Menu later via AJAX Is there some code available that can get this done. Or a code that will generate the needed JSON and then we will take this JSON as a response and ...
user avatar
0 votes
0 answers
12 views

In Magento ver. 1.9.3.3 Json Error Show

JSON Error show in Design It Tool Check attachment and link https://personalitees.com.au/pd/design/index/id/3/
user avatar
0 votes
1 answer
128 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":"...
user avatar
0 votes
1 answer
102 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($...
user avatar
1 vote
1 answer
306 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' } --> ...
user avatar
  • 1,039
0 votes
1 answer
134 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 ...
user avatar
  • 3
1 vote
2 answers
261 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 ...
user avatar
0 votes
1 answer
59 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 ...
user avatar
0 votes
1 answer
49 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']; ...
user avatar
  • 518
0 votes
0 answers
283 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 ...
user avatar
2 votes
2 answers
155 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([...
user avatar
  • 77
0 votes
2 answers
130 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": { ...
user avatar
2 votes
1 answer
250 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 ...
user avatar
  • 526
2 votes
1 answer
194 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. ...
user avatar
2 votes
1 answer
873 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": { "...
user avatar
  • 455
0 votes
1 answer
504 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">&...
user avatar
0 votes
2 answers
209 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: ...
user avatar
1 vote
4 answers
4k 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 ...
user avatar
  • 531
0 votes
1 answer
39 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/...
user avatar
0 votes
1 answer
181 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)...
user avatar
0 votes
1 answer
598 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 ...
user avatar
0 votes
1 answer
1k 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 ...
user avatar
  • 109
0 votes
1 answer
318 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 ...
user avatar
  • 694
0 votes
2 answers
738 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 ...
user avatar
0 votes
0 answers
54 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.
user avatar
0 votes
1 answer
110 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 ...
user avatar
2 votes
0 answers
122 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-...
user avatar
  • 9,473
1 vote
0 answers
158 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 ...
user avatar
0 votes
0 answers
76 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 ...
user avatar
0 votes
1 answer
337 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 ...
user avatar
  • 143
0 votes
2 answers
1k 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' => '[{...}]' ]; ...
user avatar
  • 1,353
0 votes
2 answers
25 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. ...
user avatar
  • 11
1 vote
1 answer
81 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", "...
user avatar
  • 904
2 votes
1 answer
273 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 ?
user avatar
  • 1,372
2 votes
3 answers
7k views

json encode in magento 2

I just wanted to know that what is the right way to print array data into json format. I Know we can use php function json_encode() but is this the right way to print array data? Because i saw one of ...
user avatar
  • 964
0 votes
1 answer
466 views

Magento 2 Check if a Variable contains JSON encoded code or not?

I have a variable $image, Sometimes it containes JSON Encoded value and sometimes it is not. What I need? If $image doesn't have JSON encoded data, I want to do my custom code. I am trying this: ...
user avatar
  • 934
3 votes
0 answers
83 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 ...
user avatar
  • 171
2 votes
2 answers
635 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 ...
user avatar
1 vote
0 answers
43 views

Magento Json Serializer vs native PHP

Is there any special reason why I should use the Magento framework classes such as JSON Serializer vs just native PHP? https://github.com/magento/magento2/blob/2.3/lib/internal/Magento/Framework/...
user avatar
  • 2,429
0 votes
0 answers
297 views

Magento 2.5: Uncaught SyntaxError: Unexpected end of JSON input in checkout page

I have an error in my checkout page of Magento 2.2.5 image loader loading continuously in checkout page.Show error in console of google chrome
user avatar
  • 539
-1 votes
1 answer
168 views

Unable to unserialize value

I have a problem in my Magento 2.2.5 shop. I did the migration from magento 1.9.2.1 When I want to change the category from a product I get the next error: Unable to unserialize value. The exception....
user avatar
  • 39
1 vote
0 answers
346 views

Unable to serialize value. at /public_html/vendor/magento/framework/Serialize/Serializer/Json.php:26)"} []

main.CRITICAL: Unable to serialize value. {"exception":"[object] (InvalidArgumentException(code: 0): Unable to serialize value. at /public_html/vendor/magento/framework/Serialize/Serializer/Json....
user avatar
1 vote
1 answer
1k views

How to use resultJsonFactory in Model file magento2

I have used below code to print response from my Model file. <?php class CountrylistManagement implements \Vendor\Module\Api\CountrylistManagementInterface { protected $_storeManager; ...
user avatar
  • 1,729
0 votes
1 answer
117 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']), ...
user avatar
  • 119