In Excel VBA on Windows, how to get stringified JSON respresentation instead of "[object Object]" for parsed JSON variables?
<p>answering my own question here.<br />
I have done some work with JSON in Excel VBA and lots of findings to post which I will do so in Q &amp; A format
<a href="https://stackoverflow.com/help/self-answer">https://stackoverflow.com/help/self-answer</a> <a href="https://blog.stackoverflow.com/2011/07/its-ok-to-ask-and-answer-your-own-questions/">https://blog.stackoverflow.com/2011/07/its-ok-to-ask-and-answer-your-own-questions/</a></p>
<p>So elsewhere on stackoverflow one can see questions about parsing JSON in VBA but they seem to miss a trick or two.</p>
<p>To begin with, I resile from using custom JSON parsing libraries and instead use the ScriptControl's Eval method as the basis of all my JSON code.
And also we express a preference from native Microsoft solutions.</p>
<p>Here is a prior question <a href="https://stackoverflow.com/questions/37710995/in-excel-vba-on-windows-how-to-mitigate-issue-of-dot-syntax-traversal-of-parsed">In Excel VBA on Windows, how to mitigate issue of dot syntax traversal of parsed JSON broken by IDE's capitalisation behaviour?</a> upon which this question builds.  It shows how using VBA.CallByName is more robust
than using the dot syntax to traverse a parsed JSON object.  Also another prior question <a href="https://stackoverflow.com/questions/37711034/in-excel-vba-on-windows-how-to-loop-through-a-json-array-parsed">In Excel VBA on Windows, how to loop through a JSON array parsed?</a> shows how it also can
be used to access array elements.  But CallByName returns a curious variable type that appears in Watch window as Object/JScriptTypeInfo
and if one type Debug.Print in the immediate window (or hovers over the variable) one gets the uninformative &quot;[object Object]&quot;.</p>
<p>How can we improve on this and get a JSON stringified represenation?</p>
<p>Here is a screenshot of what you see in Immediate windows after a Debug.Print (?) and if you hover over a variable.</p>
<p><a href="https://i.stack.imgur.com/owmwY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/owmwY.png" alt="object Object" /></a></p>
<p>This is Question 3 of series of 5.  Here is the full series</p>
<p>Q1 <a href="https://stackoverflow.com/questions/37710995/in-excel-vba-on-windows-how-to-mitigate-issue-of-dot-syntax-traversal-of-parsed">In Excel VBA on Windows, how to mitigate issue of dot syntax traversal of parsed JSON broken by IDE's capitalisation behaviour?</a></p>
<p>Q2 <a href="https://stackoverflow.com/questions/37711034/in-excel-vba-on-windows-how-to-loop-through-a-json-array-parsed">In Excel VBA on Windows, how to loop through a JSON array parsed?</a></p>
<p>Q3 <a href="https://stackoverflow.com/questions/37711073/in-excel-vba-on-windows-how-to-get-stringified-json-respresentation-instead-of">In Excel VBA on Windows, how to get stringified JSON respresentation instead of “[object Object]” for parsed JSON variables?</a></p>
<p>Q4 <a href="https://stackoverflow.com/questions/37711100/in-windows-excel-vba-how-to-get-json-keys-to-pre-empt-run-time-error-438-obj">In Windows Excel VBA,how to get JSON keys to pre-empt “Run-time error '438': Object doesn't support this property or method”?</a></p>
<p>Q5 <a href="https://stackoverflow.com/questions/37711112/in-excel-vba-on-windows-for-parsed-json-variables-what-is-this-jscripttypeinfo">In Excel VBA on Windows, for parsed JSON variables what is this JScriptTypeInfo anyway?</a></p>