magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

invalid json return V1/products?searchCriteria[pageSize]=12 on description custom attribute

Open srinathweb opened this issue 10 years ago • 2 comments

I am trying to get product details via rest api via following criteria /V1/products?searchCriteria[pageSize]=12 it return json but json data is invalid after "custom_attributes": [{ "attribute_code": "description",

here is some json response i got


{
    "items": [{
                "id": 2,
                "sku": "98329487",
                "name": "Corey Test Gas Range",
                "attribute_set_id": 9,
                "price": 2799,
                "status": 1,
                "visibility": 4,
                "type_id": "simple",
                "created_at": "2016-01-21 23:20:25",
                "updated_at": "2016-07-09 00:04:22",
                "weight": 450,
                "extension_attributes": [],
                "product_links": [],
                "tier_prices": [{
                    "customer_group_id": 2,
                    "qty": 2,
                    "value": 1750
                }, {
                    "customer_group_id": 2,
                    "qty": 4,
                    "value": 1450
                }],
                "custom_attributes": [{
                    "attribute_code": "special_price",
                    "value": "1500.0000"
                }, {
                    "attribute_code": "special_from_date",
                    "value": "2016-01-21 00:00:00"
                }, {
                    "attribute_code": "special_to_date",
                    "value": "2016-01-24 00:00:00"
                }, {
                    "attribute_code": "meta_title",
                    "value": "Corey Test Gas Range"
                }, {
                    "attribute_code": "meta_keyword",
                    "value": "Corey Test Gas Range"
                }, {
                    "attribute_code": "meta_description",
                    "value": "Corey Test Gas Range "
                }, {
                    "attribute_code": "color",
                    "value": "190"
                }, {
                    "attribute_code": "news_from_date",
                    "value": "2016-01-21 00:00:00"
                }, {
                    "attribute_code": "custom_design_from",
                    "value": "2016-01-21 00:00:00"
                }, {
                    "attribute_code": "options_container",
                    "value": "container2"
                }, {
                    "attribute_code": "required_options",
                    "value": "0"
                }, {
                    "attribute_code": "has_options",
                    "value": "0"
                }, {
                    "attribute_code": "url_key",
                    "value": "corey-test-gas-range"
                }, {
                    "attribute_code": "tax_class_id",
                    "value": "2"
                }, {
                    "attribute_code": "manufacturer",
                    "value": "516"
                }, {
                    "attribute_code": "ref_freezer_compressor",
                    "value": "650"
                }, {
                    "attribute_code": "ref_freezer_sections",
                    "value": "652"
                }, {
                    "attribute_code": "ref_freezer_door_type",
                    "value": "655"
                }]
            }, {
                "id": 3,
                "sku": "2938573",
                "name": "Test Deep Fryer",
                "attribute_set_id": 4,
                "price": 1315.25,
                "status": 2,
                "visibility": 4,
                "type_id": "simple",
                "created_at": "2016-03-22 21:29:42",
                "updated_at": "2016-07-11 20:11:35",
                "weight": 14,
                "extension_attributes": [],
                "product_links": [],
                "tier_prices": [{
                    "customer_group_id": 5,
                    "qty": 1,
                    "value": 979.99
                }, {
                    "customer_group_id": 10,
                    "qty": 1,
                    "value": 999.99
                }, {
                    "customer_group_id": 11,
                    "qty": 1,
                    "value": 979.99
                }, {
                    "customer_group_id": 17,
                    "qty": 1,
                    "value": 989.99
                }, {
                    "customer_group_id": 34,
                    "qty": 1,
                    "value": 1200
                }],
                "custom_attributes": [{
                            "attribute_code": "description",
                            "value": "
                            Lorem ipsum dolor sit amet,
                            consectetur adipiscing elit.In volutpat ligula augue,
                            ut tempor arcu dignissim non.Nunc et sapien mauris.Lorem ipsum dolor sit amet,
                            consectetur adipiscing elit.Vivamus et mi ut odio accumsan dignissim vel sed lectus.Pellentesque varius volutpat nunc,
                            sed auctor quam ullamcorper at.Mauris condimentum ullamcorper gravida.Vestibulum fermentum augue vel ligula facilisis,
                            tincidunt porta metus blandit.Pellentesque imperdiet ipsum diam. < \/span><\/p>\r\n


                            <
                            \/span><\/p>\r\n

                            Pellentesque metus eros,
                            commodo in feugiat quis,
                            lacinia in quam.Sed quis ligula elit.Praesent sit amet sem quam.Mauris auctor sapien vitae auctor vehicula.Sed ut ornare leo.Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.Praesent tincidunt vel lacus eget pharetra. < \/span><\/p>"},{"attribute_code":"meta_title","value":"Test Deep Fryer"},{"attribute_code":"meta_keyword","value":"Test Deep Fryer"},{"attribute_code":"meta_description","value":"Test Deep Fryer

                            Lorem ipsum dolor sit amet,
                            consectetur adipiscing elit.In volutpat ligula augue,
                            ut tempor arcu dignissim non.Nunc et sapien mauris.Lorem ipsum dolor sit amet,
                            consectetur adipiscing elit.Vivamus et mi ut odio accumsan dignis "},{"
                            attribute_code ":"
                            image ","
                            value ":"\ / s\ / o\ / socalrestshow.jpg "},{"
                            attribute_code ":"
                            small_image ","
                            value ":"\ / s\ / o\ / socalrestshow.jpg "},{"
                            attribute_code ":"
                            thumbnail ","
                            value ":"\ / s\ / o\ / socalrestshow.jpg "},{"
                            attribute_code ":"
                            options_container ","
                            value ":"
                            container2 "},{"
                            attribute_code ":"
                            required_options ","
                            value ":"
                            0 "},{"
                            attribute_code ":"
                            has_options ","
                            value ":"
                            0 "},{"
                            attribute_code ":"
                            url_key ","
                            value ":"
                            test - deep - fryer "},{"
                            attribute_code ":"
                            swatch_image ","
                            value ":"\ / s\ / o\ / socalrestshow.jpg "},{"
                            attribute_code ":"
                            tax_class_id ","
                            value ":"
                            2 "},{"
                            attribute_code ":"
                            mpn ","
                            value ":"
                            TEST "},{"
                            attribute_code ":"
                            upc ","
                            value ":"
                            TEST "},{"
                            attribute_code ":"
                            search_aliases ","
                            value ":"
                            wonton soup "}]}],"
                            search_criteria ":{"
                            filter_groups ":[],"
                            page_size ":2},"
                            total_count ":2460}


Preconditions

  1. Magento ver. 2.1.0
  2. Rest Api

Steps to reproduce

  1. /V1/products?searchCriteria[pageSize]=12 with custom_attributes description (with html mixed content)

Expected result

  1. valid json

Actual result

  1. [Screenshot, logs] invalid json json Error: Parse error on line 117: ...n", "value": " Lorem ipsum ----------------------^ Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[', got 'undefined'

srinathweb avatar Oct 12 '16 06:10 srinathweb

Could you sent your description content to reproduce?

sevos1984 avatar Oct 18 '16 16:10 sevos1984

We are closing this issue because it hasn’t been updated in more than two weeks. If you can still reproduce this issue, please create a new GitHub issue report.

sevos1984 avatar Nov 01 '16 09:11 sevos1984