RyanMarcus / dirty-json

A parser for invalid JSON
GNU Affero General Public License v3.0
307 stars 30 forks source link

fail on a broken Json with a combination of single and double quotes #17

Closed MartinoMensio closed 4 years ago

MartinoMensio commented 5 years ago

Hi!

I have another problem with this JSON, I wonder if you manage to understand why it doesn't work. If I simply remove the ' character in the middle of the claimReviewed the library manages to parse

{
  "@context": "http://schema.org",
  "@type": "ClaimReview",
  "datePublished": "2019-05-08 10:01:22",
  "url": "https://teyit.org/a-haberin-chpnin-akil-almaz-nanoteknolojik-hilesi-alt-bandi-kullandigi-iddiasi/",
  "itemReviewed":
  {
    "@type": "CreativeWork",
    "author":
    {
      "@type": "Organization",
      "name": "Sosyal Medya",
    "sameAs": "https://twitter.com/kacsaatolduson/status/1125728521110863873"
    },
    "datePublished": "05/07/2019"
  },
  "claimReviewed": "İDDİA: A Haber "CHP'nin akılalmaz nanoteknolojik hilesi" şeklinde bir alt bant kullandı.",
  "author":
  {
    "@type": "Organization",
    "name": "teyit.org",
    "sameAs": "https://teyit.org/a-haberin-chpnin-akil-almaz-nanoteknolojik-hilesi-alt-bandi-kullandigi-iddiasi/"
  },
  "reviewRating":
  {
    "@type": "Rating",
    "ratingValue": "-1",
    "bestRating": "-1",
    "worstRating": "-1",
    "alternateName" : "YANLIŞ"
  }
}

Thank you very much, Martino

RyanMarcus commented 4 years ago

This is a tough one, because the only clue that is easy to parse that this isn't an unquoted string is the newline. Should be fixed for this particular example soon, but might be other issues.