{"id":13147,"date":"2026-09-24T07:35:00","date_gmt":"2026-09-24T05:35:00","guid":{"rendered":"https:\/\/www.lukaswojcik.com\/blog\/?p=13147"},"modified":"2026-09-09T13:21:27","modified_gmt":"2026-09-09T11:21:27","slug":"tutorial-checking-a-json-payload-before-it-goes-into-a-tag","status":"publish","type":"post","link":"https:\/\/www.lukaswojcik.com\/blog\/en\/web-development\/tutorials-en-web-development\/tutorial-checking-a-json-payload-before-it-goes-into-a-tag\/","title":{"rendered":"Tutorial: Checking a JSON Payload Before It Goes Into a Tag"},"content":{"rendered":"<p>A payload that a parser rejects is annoying and harmless: something breaks immediately, in one place, and the fix takes a minute. A payload that a parser accepts and reads differently than intended is neither of those things.<\/p>\n<p>Both kinds come from the same source. JSON looks like a JavaScript object and is a much narrower format, and the differences between them are exactly the list below.<\/p>\n<figure class=\"lw-diagram\">\n<img src=\"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/diagrams\/json-pruefen-en.png\" width=\"1120\" height=\"580\" decoding=\"async\" loading=\"lazy\"\n     alt=\"A payload with seven numbered problems marked inline, and beneath it two columns separating the five that raise an exception from the two that change a value silently\"><figcaption>Five of the seven stop the parser. The other two produce a document that parses cleanly and means something else.<\/figcaption><\/figure>\n<h2>Why a JavaScript Object Is Not JSON<\/h2>\n<p>Everything valid in JSON is valid JavaScript. The reverse does not hold, and the gap between them is where the errors live.<\/p>\n<pre class=\"wp-block-kevinbatdorf-code-block-pro\"><code>{                                     \/\/ JavaScript, not JSON\n  'order_id': 9007199254740993,       \/\/ single quotes\n  total: 129.90,                      \/\/ unquoted key\n  items: [ { sku: \"SKU-42\", qty: 2, } ],   \/\/ trailing comma\n  rabatt: NaN,                        \/\/ not a JSON value\n  \/* a comment *\/\n}<\/code><\/pre>\n<p>JSON permits double quotes and nothing else, requires every key to be quoted, forbids a comma before a closing bracket, has no comments, and knows exactly seven value types: object, array, string, number, <code>true<\/code>, <code>false<\/code> and <code>null<\/code>. There is no <code>undefined<\/code>, no <code>NaN<\/code>, no <code>Infinity<\/code> and no date.<\/p>\n<p>That last point is worth stating plainly, because it produces a recurring surprise: a date has no representation of its own. Whatever arrives is a string or a number that both sides have agreed to read as a date, and any disagreement about the format is invisible to the parser.<\/p>\n<h2>The Five Errors That Raise an Exception<\/h2>\n<p>These are the loud ones, and every one of them produces the same unhelpful message about an unexpected token.<\/p>\n<table style=\"width:100%;border-collapse:collapse;table-layout:auto;\">\n<thead>\n<tr>\n<th style=\"vertical-align:top;\">Error<\/th>\n<th style=\"vertical-align:top;\">What it looks like<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"white-space:nowrap;vertical-align:top;\">Single quotes<\/td>\n<td>&#8216;order_id&#8217; instead of &#8220;order_id&#8221;<\/td>\n<\/tr>\n<tr>\n<td style=\"white-space:nowrap;vertical-align:top;\">Unquoted key<\/td>\n<td>total: 129.90 instead of &#8220;total&#8221;: 129.90<\/td>\n<\/tr>\n<tr>\n<td style=\"white-space:nowrap;vertical-align:top;\">Trailing comma<\/td>\n<td>A comma before } or ]<\/td>\n<\/tr>\n<tr>\n<td style=\"white-space:nowrap;vertical-align:top;\">Comment<\/td>\n<td>Anything after \/\/ or between \/* and *\/<\/td>\n<\/tr>\n<tr>\n<td style=\"white-space:nowrap;vertical-align:top;\">Raw line break in a string<\/td>\n<td>A newline inside quotes; it has to be \\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>A sixth belongs in the same group without being visible at all: a byte order mark at the beginning of the file. It is three invisible bytes before the opening brace, and the parser reports an unexpected token at position 0 &#8211; which looks like the brace is the problem. A file that looks flawless and fails at position 0 has one, and an editor set to save without a BOM removes it.<\/p>\n<h2>The Two That Report Nothing<\/h2>\n<p>These are the ones worth hunting for on purpose, because nothing else will point at them.<\/p>\n<p>The first is a duplicate key. The specification allows it, and the common behaviour is that the last one wins &#8211; so a document with <code>\"total\"<\/code> twice parses cleanly and carries the second value. Where the two are far apart in a long payload, the result is a number that is neither wrong-looking nor right.<\/p>\n<pre class=\"wp-block-kevinbatdorf-code-block-pro\"><code>{ \"total\": 129.90, \"currency\": \"EUR\", \"total\": 139.90 }\n\nJSON.parse(...).total   \u2192   139.90<\/code><\/pre>\n<p>The second is a large integer. Numbers in JavaScript are floating point, and integers stay exact only up to 2^53 \u2212 1. An order number, an ID from a database, a Meta CAPI identifier &#8211; all of them regularly exceed that, and the parser rounds them without a word.<\/p>\n<pre class=\"wp-block-kevinbatdorf-code-block-pro\"><code>JSON.parse('{\"id\": 9007199254740993}').id   \u2192   9007199254740992\n\nJSON.parse('{\"id\": \"9007199254740993\"}').id \u2192   \"9007199254740993\"<\/code><\/pre>\n<p>The rule that follows is short: an identifier is a string, always, even when it consists only of digits. Nothing is ever calculated with it, and a string survives every parser unchanged.<\/p>\n<h2>Reading the Position a Parser Reports<\/h2>\n<p>The position in the error message is a character offset into the whole document, which in a minified payload is a number without meaning.<\/p>\n<p>The first step is therefore always to format the document, not to look for the error. A formatted payload puts the position onto a line, and the line above the reported one is usually where the fault actually is &#8211; a missing comma is noticed at the next token, not at the place it is missing from.<\/p>\n<pre class=\"wp-block-kevinbatdorf-code-block-pro\"><code>try {\n  JSON.parse(text);\n} catch (e) {\n  const stelle = Number((e.message.match(\/position (\\d+)\/) || [])[1]);\n  if (!Number.isNaN(stelle)) {\n    console.log(text.slice(Math.max(0, stelle - 60), stelle + 60));\n    console.log(\" \".repeat(Math.min(60, stelle)) + \"^\");\n  }\n}<\/code><\/pre>\n<p>Sixty characters either side of the position is enough to see the problem in almost every case, and the caret removes the counting. This is worth having as a snippet, because the alternative is opening a formatter, pasting, scrolling and losing the position.<\/p>\n<h2>Checking It on the Command Line<\/h2>\n<p>Where the payload comes out of a file or a request, a single command answers the question.<\/p>\n<pre class=\"wp-block-kevinbatdorf-code-block-pro\"><code># valid? formatted output, or an error with a line number\njq . nutzlast.json\n\n# only the answer, without the content\njq -e . nutzlast.json &gt;\/dev\/null &amp;&amp; echo \"gueltig\" || echo \"ungueltig\"\n\n# find duplicate keys - jq keeps the last, this counts them\njq -r 'paths(scalars) | join(\".\")' nutzlast.json | sort | uniq -d\n\n# large numbers that will lose precision\ngrep -oE '\"[a-z_]+\": *[0-9]{16,}' nutzlast.json<\/code><\/pre>\n<p>The third command is the one worth running on a payload that has never been checked. It lists the paths that occur more than once, which is the only mechanical way to find the silent case &#8211; and on a generated payload it finds something surprisingly often, because a template that appends a field in two branches produces exactly this.<\/p>\n<h2>Where It Matters Most<\/h2>\n<p>Three places turn a small JSON mistake into something that is hard to notice afterwards.<\/p>\n<p>A JSON-LD block in the page is the first. A syntax error means search engines read no structured data at all, and the page keeps working perfectly &#8211; so nothing about the site suggests a problem, and the loss appears weeks later as missing rich results. A validator on the rendered page, not on the template, is the check that catches it.<\/p>\n<p>A conversions API payload is the second. The receiving platform answers with an error, but that error is on a server-to-server response nobody is watching, and a failed event simply does not appear. This is the case where the duplicate key does the most damage: a payload with an event value twice sends the wrong one, and both the sender and the receiver consider the request successful.<\/p>\n<p>A tag manager template configuration is the third. Its JSON is read once when the template is loaded, and a malformed field can leave the template installed but inert. What makes this one different is that it fails at the moment of import rather than at runtime &#8211; which is a better place to fail, and only if somebody reads the message.<\/p>\n<p>What all three have in common: they are checked at the point where the payload is produced, not where it is consumed. A build step that runs the parser over every generated file costs nothing and catches all five loud errors before they leave the machine.<\/p>\n<div class=\"lw-quellen\">\n<h2>Sources<\/h2>\n<ul>\n<li><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\/Reference\/Elements\/script\" target=\"_blank\" rel=\"noopener noreferrer\">MDN: the script element<\/a><\/li>\n<li><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\" target=\"_blank\" rel=\"noopener noreferrer\">MDN: JavaScript<\/a><\/li>\n<\/ul>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Five mistakes make a parser refuse the whole document and name a position nobody can find. Two more make it accept the document and quietly change a value &#8211; and those two are the ones worth looking for on purpose.<\/p>\n","protected":false},"author":1,"featured_media":13255,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[158],"tags":[91144,91312,91219],"class_list":["post-13147","post","type-post","status-publish","format-standard","hentry","category-tutorials-en-web-development","tag-devops","tag-javascript","tag-tutorial"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Tutorial: Checking a JSON Payload Before It Goes Into a Tag - Lukas Wojcik - Blog<\/title>\n<meta name=\"description\" content=\"Why a JavaScript object is not JSON, the five errors that raise an exception, and the two that change a value without any warning.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.lukaswojcik.com\/blog\/en\/web-development\/tutorials-en-web-development\/tutorial-checking-a-json-payload-before-it-goes-into-a-tag\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Tutorial: Checking a JSON Payload Before It Goes Into a Tag - Lukas Wojcik - Blog\" \/>\n<meta property=\"og:description\" content=\"Why a JavaScript object is not JSON, the five errors that raise an exception, and the two that change a value without any warning.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.lukaswojcik.com\/blog\/en\/web-development\/tutorials-en-web-development\/tutorial-checking-a-json-payload-before-it-goes-into-a-tag\/\" \/>\n<meta property=\"og:site_name\" content=\"Lukas Wojcik - Blog\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-24T05:35:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/08\/hero-13147-tutorial-checking-a-json-payload-before-.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Lukas Wojcik\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Lukas Wojcik\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/web-development\\\/tutorials-en-web-development\\\/tutorial-checking-a-json-payload-before-it-goes-into-a-tag\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/web-development\\\/tutorials-en-web-development\\\/tutorial-checking-a-json-payload-before-it-goes-into-a-tag\\\/\"},\"author\":{\"name\":\"Lukas Wojcik\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#\\\/schema\\\/person\\\/895f7604f9b6b71aad9bba33af28d0f9\"},\"headline\":\"Tutorial: Checking a JSON Payload Before It Goes Into a Tag\",\"datePublished\":\"2026-09-24T05:35:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/web-development\\\/tutorials-en-web-development\\\/tutorial-checking-a-json-payload-before-it-goes-into-a-tag\\\/\"},\"wordCount\":991,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#\\\/schema\\\/person\\\/895f7604f9b6b71aad9bba33af28d0f9\"},\"image\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/web-development\\\/tutorials-en-web-development\\\/tutorial-checking-a-json-payload-before-it-goes-into-a-tag\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/08\\\/hero-13147-tutorial-checking-a-json-payload-before-.png\",\"keywords\":[\"DevOps\",\"JavaScript\",\"Tutorial\"],\"articleSection\":[\"Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/web-development\\\/tutorials-en-web-development\\\/tutorial-checking-a-json-payload-before-it-goes-into-a-tag\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/web-development\\\/tutorials-en-web-development\\\/tutorial-checking-a-json-payload-before-it-goes-into-a-tag\\\/\",\"url\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/web-development\\\/tutorials-en-web-development\\\/tutorial-checking-a-json-payload-before-it-goes-into-a-tag\\\/\",\"name\":\"Tutorial: Checking a JSON Payload Before It Goes Into a Tag - Lukas Wojcik - Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/web-development\\\/tutorials-en-web-development\\\/tutorial-checking-a-json-payload-before-it-goes-into-a-tag\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/web-development\\\/tutorials-en-web-development\\\/tutorial-checking-a-json-payload-before-it-goes-into-a-tag\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/08\\\/hero-13147-tutorial-checking-a-json-payload-before-.png\",\"datePublished\":\"2026-09-24T05:35:00+00:00\",\"description\":\"Why a JavaScript object is not JSON, the five errors that raise an exception, and the two that change a value without any warning.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/web-development\\\/tutorials-en-web-development\\\/tutorial-checking-a-json-payload-before-it-goes-into-a-tag\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/web-development\\\/tutorials-en-web-development\\\/tutorial-checking-a-json-payload-before-it-goes-into-a-tag\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/web-development\\\/tutorials-en-web-development\\\/tutorial-checking-a-json-payload-before-it-goes-into-a-tag\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/08\\\/hero-13147-tutorial-checking-a-json-payload-before-.png\",\"contentUrl\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/08\\\/hero-13147-tutorial-checking-a-json-payload-before-.png\",\"width\":1200,\"height\":630,\"caption\":\"Tutorial: Checking a JSON Payload Before It Goes Into a Tag\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/en\\\/web-development\\\/tutorials-en-web-development\\\/tutorial-checking-a-json-payload-before-it-goes-into-a-tag\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Tutorial: Checking a JSON Payload Before It Goes Into a Tag\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/\",\"name\":\"Lukas Wojcik - Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#\\\/schema\\\/person\\\/895f7604f9b6b71aad9bba33af28d0f9\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/#\\\/schema\\\/person\\\/895f7604f9b6b71aad9bba33af28d0f9\",\"name\":\"Lukas Wojcik\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/lw-x2.jpg\",\"url\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/lw-x2.jpg\",\"contentUrl\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/lw-x2.jpg\",\"width\":424,\"height\":636,\"caption\":\"Lukas Wojcik\"},\"logo\":{\"@id\":\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/07\\\/lw-x2.jpg\"},\"sameAs\":[\"https:\\\/\\\/www.lukaswojcik.com\\\/blog\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Tutorial: Checking a JSON Payload Before It Goes Into a Tag - Lukas Wojcik - Blog","description":"Why a JavaScript object is not JSON, the five errors that raise an exception, and the two that change a value without any warning.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.lukaswojcik.com\/blog\/en\/web-development\/tutorials-en-web-development\/tutorial-checking-a-json-payload-before-it-goes-into-a-tag\/","og_locale":"en_US","og_type":"article","og_title":"Tutorial: Checking a JSON Payload Before It Goes Into a Tag - Lukas Wojcik - Blog","og_description":"Why a JavaScript object is not JSON, the five errors that raise an exception, and the two that change a value without any warning.","og_url":"https:\/\/www.lukaswojcik.com\/blog\/en\/web-development\/tutorials-en-web-development\/tutorial-checking-a-json-payload-before-it-goes-into-a-tag\/","og_site_name":"Lukas Wojcik - Blog","article_published_time":"2026-09-24T05:35:00+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/08\/hero-13147-tutorial-checking-a-json-payload-before-.png","type":"image\/png"}],"author":"Lukas Wojcik","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Lukas Wojcik","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/web-development\/tutorials-en-web-development\/tutorial-checking-a-json-payload-before-it-goes-into-a-tag\/#article","isPartOf":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/web-development\/tutorials-en-web-development\/tutorial-checking-a-json-payload-before-it-goes-into-a-tag\/"},"author":{"name":"Lukas Wojcik","@id":"https:\/\/www.lukaswojcik.com\/blog\/#\/schema\/person\/895f7604f9b6b71aad9bba33af28d0f9"},"headline":"Tutorial: Checking a JSON Payload Before It Goes Into a Tag","datePublished":"2026-09-24T05:35:00+00:00","mainEntityOfPage":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/web-development\/tutorials-en-web-development\/tutorial-checking-a-json-payload-before-it-goes-into-a-tag\/"},"wordCount":991,"commentCount":0,"publisher":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/#\/schema\/person\/895f7604f9b6b71aad9bba33af28d0f9"},"image":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/web-development\/tutorials-en-web-development\/tutorial-checking-a-json-payload-before-it-goes-into-a-tag\/#primaryimage"},"thumbnailUrl":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/08\/hero-13147-tutorial-checking-a-json-payload-before-.png","keywords":["DevOps","JavaScript","Tutorial"],"articleSection":["Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.lukaswojcik.com\/blog\/en\/web-development\/tutorials-en-web-development\/tutorial-checking-a-json-payload-before-it-goes-into-a-tag\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/web-development\/tutorials-en-web-development\/tutorial-checking-a-json-payload-before-it-goes-into-a-tag\/","url":"https:\/\/www.lukaswojcik.com\/blog\/en\/web-development\/tutorials-en-web-development\/tutorial-checking-a-json-payload-before-it-goes-into-a-tag\/","name":"Tutorial: Checking a JSON Payload Before It Goes Into a Tag - Lukas Wojcik - Blog","isPartOf":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/web-development\/tutorials-en-web-development\/tutorial-checking-a-json-payload-before-it-goes-into-a-tag\/#primaryimage"},"image":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/web-development\/tutorials-en-web-development\/tutorial-checking-a-json-payload-before-it-goes-into-a-tag\/#primaryimage"},"thumbnailUrl":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/08\/hero-13147-tutorial-checking-a-json-payload-before-.png","datePublished":"2026-09-24T05:35:00+00:00","description":"Why a JavaScript object is not JSON, the five errors that raise an exception, and the two that change a value without any warning.","breadcrumb":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/web-development\/tutorials-en-web-development\/tutorial-checking-a-json-payload-before-it-goes-into-a-tag\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.lukaswojcik.com\/blog\/en\/web-development\/tutorials-en-web-development\/tutorial-checking-a-json-payload-before-it-goes-into-a-tag\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/web-development\/tutorials-en-web-development\/tutorial-checking-a-json-payload-before-it-goes-into-a-tag\/#primaryimage","url":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/08\/hero-13147-tutorial-checking-a-json-payload-before-.png","contentUrl":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/08\/hero-13147-tutorial-checking-a-json-payload-before-.png","width":1200,"height":630,"caption":"Tutorial: Checking a JSON Payload Before It Goes Into a Tag"},{"@type":"BreadcrumbList","@id":"https:\/\/www.lukaswojcik.com\/blog\/en\/web-development\/tutorials-en-web-development\/tutorial-checking-a-json-payload-before-it-goes-into-a-tag\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.lukaswojcik.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Tutorial: Checking a JSON Payload Before It Goes Into a Tag"}]},{"@type":"WebSite","@id":"https:\/\/www.lukaswojcik.com\/blog\/#website","url":"https:\/\/www.lukaswojcik.com\/blog\/","name":"Lukas Wojcik - Blog","description":"","publisher":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/#\/schema\/person\/895f7604f9b6b71aad9bba33af28d0f9"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.lukaswojcik.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.lukaswojcik.com\/blog\/#\/schema\/person\/895f7604f9b6b71aad9bba33af28d0f9","name":"Lukas Wojcik","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/07\/lw-x2.jpg","url":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/07\/lw-x2.jpg","contentUrl":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/07\/lw-x2.jpg","width":424,"height":636,"caption":"Lukas Wojcik"},"logo":{"@id":"https:\/\/www.lukaswojcik.com\/blog\/wp-content\/uploads\/2026\/07\/lw-x2.jpg"},"sameAs":["https:\/\/www.lukaswojcik.com\/blog"]}]}},"_links":{"self":[{"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/posts\/13147","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/comments?post=13147"}],"version-history":[{"count":1,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/posts\/13147\/revisions"}],"predecessor-version":[{"id":17251,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/posts\/13147\/revisions\/17251"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/media\/13255"}],"wp:attachment":[{"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/media?parent=13147"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/categories?post=13147"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lukaswojcik.com\/blog\/wp-json\/wp\/v2\/tags?post=13147"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}