0

I get json parse error on ruby code the article is on arabic because of :

JSON.parse(open('https://www.examlpe.com/wp-json/wp/v2/posts').read)
<p dir=\"rtl\">\u0623\u0639\u0644\u0646\u062a \u0627\u0644\u0634\u0631\u0643\u0629 \u0627\u0644\u0648\u0637\u0646\u064a\u0629 \u0644\u0644\u0646\u0642\u0644 \u0628\u0627\u0644\u0633\u0643\u0643 .<\/p>
Jordan Running
  • 102,619
  • 17
  • 182
  • 182
ramzieus
  • 138
  • 11

1 Answers1

0

I get the solution by remove the BOM

JSON.parse(open('https://www.example.com/wp-json/wp/v2/posts').read.gsub!("\xEF\xBB\xBF".force_encoding("UTF-8"), '')
ramzieus
  • 138
  • 11