Geethika
Geethika14mo ago

I have JSON response as below

{ "data": [ { "id": 3, "attributes": { "industryType": "Food And Beverage", "about": "*Michael’s Icecream Burger* is the first of its kind, Conceptualized in New York. “CRUNCHILICIOUS!!!” - Hot & Crunchy on the outside, Cold & Mushy on the inside. We also serve the most creamiest ice cream Scoops & Sundaes. \n\n*Michael’s Icecream Burger* is UNIQUE!!! and highly profitable in all the ways…\n\n*Products and Services*\n\nLow Investment\nHighest profit margin compare to any other competitor (150% to 300% Profit Margin)\nHighly affordable prices (Rs. 40/- to Rs. 140/-)\nAvailable in 3 Formats – Mobile Vehicle, Mall Kiosk, Independent Store\nProducts and Services\n\nIce cream burgers, ice cream sundaes, exotic and natural ice cream scoops, a range of hot and cold coffees, Belgian waffles., } } ], "meta": { "pagination": { "page": 1, "pageSize": 25, "pageCount": 1, "total": 1 } } } I would like to extract about from the JSON string and split it based on newline char. I've done this using str.split("\n") and also str.split(/\n/) but it doesn't seem to work. Please help find the problem!
3 Replies
Geethika
Geethika14mo ago
I have , const aboutInfo = JSON.stringify(brand.attributes.about) const aboutUs = JSON.parse(aboutInfo) and <ul> {aboutUs.split("\n").map((abu)=>{ <li> {abu} </li> })} </ul> but doesn't seem to work
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
Geethika
Geethika14mo ago
Thanks for pointing it out!