Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to parse " in react native

I am fetching some data from API and it is returning me results like " how can I convert it to normal form ' " '

const results = [
  { question: ' movie "The Revenant"?' },
  { question: ' game "Roblox" released?' },
  { question: '"A rainy Lithuanian / Is dancing as an Indian"' },
];

export default function App() {
  return (
    <View style={styles.container}>
      {results.map((q) => (
        <Text> {q.question} </Text>
      ))}
    </View>
  );
}

this is what I am getting

enter image description here

like image 821
Mahir Asrani Avatar asked Aug 24 '26 20:08

Mahir Asrani


1 Answers

one way you can use replace in client side like that :

  • .replace(/&quot;/g, '"')

or other way you can save quot in database and send from backend side like format:

  • question: ' movie '''The Revenant'''?'

I hope that's Helpful

like image 176
Meisan Saba Avatar answered Aug 26 '26 10:08

Meisan Saba