0

Getting API response as below:

{
    "response": {
        "id": "145",
        "sku": "MT12",
        "name": "Muscletech Cell Tech, 3.09lbs",
        "price": "3,999.00",
        "earn_points": "160",
        "product_url": "http://staging.softprodigy.in/FitBasket/muscletech-celltech.html",
        "min_qty_sale": null,
        "price_html": "",
        "final_disc": "25",
        "final_price": "2,999.00",
        "final_earn_points": "120",
        "tier_price_html": "\r\n",
        "description": "Cell -Tech delivers 7 grams of HPLC certified creatine monohydrate and 3 grams of creatine HCl which helps improve between-set muscle recovery, amplify muscle performance and build more lean muscle. Cell -Tech delivers a multi-stage combination of carbohydrates which helps shuttle creatine into the muscle and rapidly replenishes glycogen stores and deliver an intense muscle-expanding effect. Cell -Tech supplies L-leucine, L-valine and L-isoleucine in a 2:1:1 ratio as well as taurine and alanine. These free-form amino acids are some of the most abundant amino acids in muscle and aid in cell volumization. Cell -Tech includes 200mg of alpha lipoic acid (ALA). Research suggests that ALA helps improve the absorption of creatine and glucose into the muscle cell through specialized transporters. No proprietary blends or no under dosed key ingredients, no fillers – period. MuscleTech Performance Series supplements gives it to you straight with fully disclosed doses (no proprietary blends), no fillers, no hype and no exceptions. Our products are built on legitimate science so that you get what you pay for. Make the smart choice. We challenge you to compare.",
        "short_description": "Authorised Importer : M/s Shri Balaji Overeseas( Global Impex )/ MPN ",
        "is_desc_html": false,
        "is_sort_desc_html": false,
        "group_price": [],
        "tier_price": [],
        "price_type": null,
        "type_id": "simple",
        "is_recurring": 0,
        "start_date_is_editable": 0,
        "in_stock": 1,
        "images": [
            {
                "url": "http://staging.softprodigy.in/FitBasket/media/catalog/product/m/t/mt_celltech_5.95lb_1.jpg",
                "imgname": "/m/t/mt_celltech_5.95lb_1.jpg"
            }
        ],
        "review_count": "0",
        "rating_percent": 0,
        "options": [
            {
                "option_id": "5",
                "product_id": "145",
                "type": "drop_down",
                "is_require": "1",
                "sku": null,
                "max_characters": null,
                "file_extension": null,
                "image_size_x": null,
                "image_size_y": null,
                "sort_order": "0",
                "default_title": "Flavours",
                "store_title": "",
                "title": "Flavours",
                "default_price": "0.00",
                "default_price_type": null,
                "store_price": null,
                "store_price_type": null,
                "price": "0.00",
                "price_type": null,
                "additional_fields": [
                    {
                        "option_type_id": "11",
                        "option_id": "5",
                        "sku": null,
                        "sort_order": "0",
                        "default_title": "Fruit Punch",
                        "store_title": null,
                        "title": "Fruit Punch",
                        "default_price": "0.00",
                        "default_price_type": "fixed",
                        "store_price": null,
                        "store_price_type": null,
                        "price": "0.00",
                        "price_type": "fixed",
                        "price_percent": "0.00"
                    },
                    {
                        "option_type_id": "171",
                        "option_id": "5",
                        "sku": null,
                        "sort_order": "0",
                        "default_title": "Orange",
                        "store_title": null,
                        "title": "Orange",
                        "default_price": "0.00",
                        "default_price_type": "fixed",
                        "store_price": null,
                        "store_price_type": null,
                        "price": "0.00",
                        "price_type": "fixed",
                        "price_percent": "0.00"
                    }
                ]
            }
        ],
        "specification": [
            {
                "label": "Info",
                "value": "<ul class=\"a-unordered-list a-vertical a-spacing-none\" style=\"box-sizing: border-box; margin: 0px 0px 18px 18px; color: #949494; padding: 0px; font-family: 'Amazon Ember', Arial, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration-style: initial; text-decoration-color: initial;\">\r\n<li style=\"box-sizing: border-box; list-style: disc; word-wrap: break-word; margin: 0px;\"><span class=\"a-list-item\" style=\"box-sizing: border-box; color: #111111;\">Ultimate hardgainer creatine formula</span></li>\r\n

                <li style=\"box-sizing: border-box; list-style: disc; word-wrap: break-word; margin: 0px;\"><span class=\"a-list-item\" style=\"box-sizing: border-box; color: #111111;\">

                Increases muscle size, recovery and strength
                </span></li>

                \r\n
                <li style=\"box-sizing: border-box; list-style: disc; word-wrap: break-word; margin: 0px;\"><span class=\"a-list-item\" style=\"box-sizing: border-box; color: #111111;\">7 grams creatine monohydrate and 3 grams of creatine HCl (per max 2 scoop serving)</span></li>

                \r\n<li style=\"box-sizing: border-box; list-style: disc; word-wrap: break-word; margin: 0px;\"><span class=\"a-list-item\" style=\"box-sizing: border-box; color: #111111;\">75 grams of multi-stage carbohydrates for glycogen replenishment post-workout and to shuttle creatine into muscles</span></li>\r\n<li style=\"box-sizing: border-box; list-style: disc; word-wrap: break-word; margin: 0px;\"><span class=\"a-list-item\" style=\"box-sizing: border-box; color: #111111;\">Subjects gained 3.4 lbs of muscle in 7 days</span></li>\r\n</ul>",
                "code": "info"
            },
            {
                "label": "Nutrition Fact",
                "value": "No",
                "code": "nutrition_fact"
            },
            {
                "label": "How to Use",
                "value": "No",
                "code": "how_to_use"
            }
        ],
        "related": [
            {
                "name": "MuscleTech 100% Premium Whey Protein Plus, 5lbs",
                "id": "151",
                "minimal_price": "",
                "img": "http://staging.softprodigy.in/FitBasket/media/catalog/product/cache/1/image/650x456/9df78eab33525d08d6e5fb8d27136e95/8/1/81xoc6y_ysl._sl1500_.jpg",
                "price": "6,299.00",
                "final_price": "4,249.00",
                "final_disc": "33"
            },
            {
                "name": "ON (Optimum Nutrition) Gold Standard 100% Whey, 2lbs. ",
                "id": "172",
                "minimal_price": "",
                "img": "http://staging.softprodigy.in/FitBasket/media/catalog/product/cache/1/image/650x456/9df78eab33525d08d6e5fb8d27136e95/i/m/image_24157_original_x_130_white_1_1_1.jpg",
                "price": "3,699.00",
                "final_price": "3,099.00",
                "final_disc": "16"
            },
            {
                "name": "Dymatize Elite 100% Whey Protein, 2lbs",
                "id": "225",
                "minimal_price": "",
                "img": "http://staging.softprodigy.in/FitBasket/media/catalog/product/cache/1/image/650x456/9df78eab33525d08d6e5fb8d27136e95/1/0/100_wheyprotein2lb_1.jpg",
                "price": "3,899.00",
                "final_price": "2,899.00",
                "final_disc": "26"
            }
        ],
        "associated": [],
        "config_attributes": {},
        "bundle_options": [],
        "downloadable_options": [],
        "wishlist_item_id": null,
        "custom_banner": null,
        "upsell_products": [
            {
                "product_id": "159",
                "type_id": "simple",
                "name": "Ultimate Nutrition Prostar 100% Whey Protein, 5.28lbs ",
                "price": "5,499.00",
                "price_html": "",
                "minimal_price": "",
                "final_disc": "18",
                "final_price": "4,499.00",
                "image": "http://staging.softprodigy.in/FitBasket/media/catalog/product/cache/1/small_image/650x456/9df78eab33525d08d6e5fb8d27136e95/9/1/91iatrllpwl._sl1500__2.jpg",
                "in_stock": false,
                "created": "2017-05-01 02:04:07",
                "is_new_prod": "1",
                "rating": 0,
                "rating_count": 0
            },
            {
                "product_id": "269",
                "type_id": "simple",
                "name": "Ultimate Nutrition Prostar 100% Whey Protein, 1lbs",
                "price": "1,839.00",
                "price_html": "",
                "minimal_price": "",
                "final_disc": "16",
                "final_price": "1,549.00",
                "image": "http://staging.softprodigy.in/FitBasket/media/catalog/product/cache/1/small_image/650x456/9df78eab33525d08d6e5fb8d27136e95/p/r/pro.jpg",
                "in_stock": true,
                "created": "2017-12-11 01:01:32",
                "is_new_prod": "0",
                "rating": 0,
                "rating_count": 0
            },
            {
                "product_id": "178",
                "type_id": "simple",
                "name": "ON (Optimum Nutrition) Creatine Powder, 0.6lb",
                "price": "1,617.00",
                "price_html": "",
                "minimal_price": "",
                "final_disc": "44",
                "final_price": "899.00",
                "image": "http://staging.softprodigy.in/FitBasket/media/catalog/product/cache/1/small_image/650x456/9df78eab33525d08d6e5fb8d27136e95/o/n/on_creatine_1.jpg",
                "in_stock": true,
                "created": "2017-05-04 04:22:16",
                "is_new_prod": "0",
                "rating": 0,
                "rating_count": 0
            },
            {
                "product_id": "233",
                "type_id": "simple",
                "name": "Dymatize Creatine Micronized, 0.66lbs",
                "price": "1,199.00",
                "price_html": "",
                "minimal_price": "",
                "final_disc": "25",
                "final_price": "899.00",
                "image": "http://staging.softprodigy.in/FitBasket/media/catalog/product/cache/1/small_image/650x456/9df78eab33525d08d6e5fb8d27136e95/d/y/dymatize-creatine.jpg",
                "in_stock": true,
                "created": "2017-05-10 02:39:31",
                "is_new_prod": "0",
                "rating": 0,
                "rating_count": 0
            }
        ],
        "youtube_video": null,
        "is_featured": null,
        "is_new_prod": "0"
    },
    "returnCode": {
        "result": 1,
        "resultText": "success"
    }
}
  • Just a dump of your code and a smattering of tags to not even properly reveal which version you are using? Not very well prepared. – tripleee Feb 15 '18 at 6:27
0

It looks like like the ul are coming from a wysiwyg field that is on a product. You could use php's strip_tags to remove all html tags from the specification field.

It's a little hard to give more of an answer as i can't tell if you want this to be on the magento api when its returning that response or if you are parsing that response.

0

How remove \r\n\ tag ?

Ans::-              $page = str_replace("\r\n", '', $content);
                    $page_data[$p]['content'] = strip_tags($page, "<li>");

{
    "response": [{
        "id": "191",
        "title": "About us",
        "content": "Health is Wealth, Save both with FitBasket. FitBasket is No. 1 online Retailer of Sports and lifestyle Nutrition in Delhi\/NCR. FitBaskeet provides customers with access to the most sought after Sports, Bodybuilding, and General Health Supplements available on the market, with an emphasis on lowest possible price, professional quality and customer service. We're a young start-up of around 50 people that specialize in sports and general health nutrition, whose first priority is to customize supplement and nutritional advice for each customer.                                                                                                                                                 Our goal is to help you reach yours, because our passion, is your passion.\r\n \r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n Get Authentic or Get Refund. \r\n\r\n\r\n\r\n\r\n\r\nYou don't have to read between the lines: FitBasket only believes in dealing with authentic food Supplements, counterfeit or Grey market products are absolutely not accepted. So if you think the item you bought on FitBasket isn't 100% genuine, just send it to us, we'll return your money right away!\r\n\r\nWhy Authenticity Matters!\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n "
    }],
    "returnCode": {
        "result": 1,
        "resultText": "success"
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.