I have a json object such as:
var json = {
"title": "Math Symbols: ¬",
"sections": [
"The ¬ symbol",
"¬ and y"
]
};
I need to replace all instances of the "¬" character with something that looks like the Mathematical symbol for x: sample.
Side note: I can't use that actual symbol (html entity 𝑥
) because the Arial font i'm using doesn't support it. So I was planning on replacing "¬" with <span class="math">x</span>
and styling the math class with Times New Roman & italic.
I can't change the Arial Font, and I don't need any other Math symbols - MathML support or the like isn't necessary.
Something like this would be ideal:
json = json.replace("¬", "<span class='math'>x</span>");
I have a json object such as:
var json = {
"title": "Math Symbols: ¬",
"sections": [
"The ¬ symbol",
"¬ and y"
]
};
I need to replace all instances of the "¬" character with something that looks like the Mathematical symbol for x: sample.
Side note: I can't use that actual symbol (html entity 𝑥
) because the Arial font i'm using doesn't support it. So I was planning on replacing "¬" with <span class="math">x</span>
and styling the math class with Times New Roman & italic.
I can't change the Arial Font, and I don't need any other Math symbols - MathML support or the like isn't necessary.
Something like this would be ideal:
json = json.replace("¬", "<span class='math'>x</span>");
Share
Improve this question
asked Aug 19, 2013 at 10:24
aaronjbaptisteaaronjbaptiste
5544 silver badges14 bronze badges
1 Answer
Reset to default 11This converts the JSON into string
JSON.stringify(json).replace(/¬/g, "<span class='math'>x</span>")
and then you could convert it back to JSON
JSON.parse(json)