Incorrectly formatted JSON
-
I reported a coding error 10 months ago and provided an easy fix. After downloading the newest version I can see that the error still exists. Can you please take a look at this and fix in your next version? I’m having to fix this every time I update.
The plugin injects a JSON object in the page head that can be an incorrectly formatted JSON object if the post content includes the ” character. To fix this I added a str_replace call on line 44 of /app/services/review-schema.php to replace all occurrences of the ” character with \”.
$schema_reviews = '{ "@context": "https://schema.org", "@type": "Product", "aggregateRating": { "@type": "AggregateRating", "ratingValue": "' . $get_overall_ratings_score . '", "reviewCount": "' . $post->comment_count . '" }, "description": "' . str_replace('"', '\"', $post->post_content) . '", "name": "' . $post->post_title . '", "image": "' . $args['featured_image_url'] . '" }';
- The topic ‘Incorrectly formatted JSON’ is closed to new replies.