<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Trouble passing decoded json to variable]]></title><description><![CDATA[<p dir="auto">Hello,</p>
<p dir="auto">I know I have the product of the http get command in the machine.  I am able to lcd print the information from the variable that json has passed it to in get data.  I also can lcd print the information from the variable that json loads it to.  So, I know it is in the machine.</p>
<p dir="auto">I am having trouble getting the data into a variable which will print into a label.  I have tried many iterations of what is suggested; none of what I have tried will work for me.</p>
<p dir="auto">Here is the data:</p>
<p dir="auto">{<br />
"kind": "youtube#channelListResponse",<br />
"etag": "ZWPSr7cMrsGoEEQ08azuShUDwZo",<br />
"pageInfo": {<br />
"totalResults": 1,<br />
"resultsPerPage": 5<br />
},<br />
"items": [<br />
{<br />
"kind": "youtube#channel",<br />
"etag": "lRmGa0iYmbwfpoT2xfLWeRNgEGI",<br />
"id": "UCGeW5FIXqU4bhyq70skLPxA",<br />
"statistics": {<br />
"viewCount": "10474",<br />
"subscriberCount": "240",<br />
"hiddenSubscriberCount": false,<br />
"videoCount": "23"<br />
}<br />
}<br />
]<br />
}</p>
<p dir="auto">I want to have a variable pass the info to a label</p>
<p dir="auto">items:statistics:viewCount<br />
items:statistics:subscriberCount</p>
<p dir="auto">Can anyone help?</p>
<p dir="auto">Bill</p>
]]></description><link>https://community.m5stack.com/topic/4321/trouble-passing-decoded-json-to-variable</link><generator>RSS for Node</generator><lastBuildDate>Mon, 16 Mar 2026 02:50:28 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/4321.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 27 May 2022 00:16:01 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Trouble passing decoded json to variable on Thu, 06 Feb 2025 05:12:22 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/19861">@captbd</a> said in <a href="/post/17640">Trouble passing decoded json to variable</a>:</p>
<blockquote>
<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/443">@ajb2k3</a> Found the answer after a long time down the rabbit hole.  It was not possible for me with the current blockly code.  Changing to the python window, however, and incorporating the ujson functions that were taught in the weather app tutorial on youTube<a href="https://8171programs.pk/bisp-8171-result-check-by-cnic/" target="_blank" rel="noopener noreferrer nofollow ugc">,</a> I was able to get it done.</p>
<p dir="auto">Just was not able to get it done with available blockly.  Now, the issue is that my UI Flow program completely eradicated my fix every time I exit.  It won't save the correct code because it was done in the python window.</p>
<p dir="auto">So, I can't recreate it easily.</p>
</blockquote>
]]></description><link>https://community.m5stack.com/post/28134</link><guid isPermaLink="true">https://community.m5stack.com/post/28134</guid><dc:creator><![CDATA[hector01]]></dc:creator><pubDate>Thu, 06 Feb 2025 05:12:22 GMT</pubDate></item><item><title><![CDATA[Reply to Trouble passing decoded json to variable on Sun, 05 Jun 2022 11:13:11 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/19861">@captbd</a> Can you paste your code here?<br />
You can use the Execute code block to run custom code in blocky and it does save it.</p>
]]></description><link>https://community.m5stack.com/post/17648</link><guid isPermaLink="true">https://community.m5stack.com/post/17648</guid><dc:creator><![CDATA[ajb2k3]]></dc:creator><pubDate>Sun, 05 Jun 2022 11:13:11 GMT</pubDate></item><item><title><![CDATA[Reply to Trouble passing decoded json to variable on Sat, 04 Jun 2022 07:27:05 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/443">@ajb2k3</a> Found the answer after a long time down the rabbit hole.  It was not possible for me with the current blockly code.  Changing to the python window, however, and incorporating the ujson functions that were taught in the weather app tutorial on youTube, I was able to get it done.</p>
<p dir="auto">Just was not able to get it done with available blockly.  Now, the issue is that my UI Flow program completely eradicated my fix every time I exit.  It won't save the correct code because it was done in the python window.</p>
<p dir="auto">So, I can't recreate it easily.</p>
]]></description><link>https://community.m5stack.com/post/17640</link><guid isPermaLink="true">https://community.m5stack.com/post/17640</guid><dc:creator><![CDATA[captbd]]></dc:creator><pubDate>Sat, 04 Jun 2022 07:27:05 GMT</pubDate></item><item><title><![CDATA[Reply to Trouble passing decoded json to variable on Mon, 30 May 2022 13:38:37 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/19861">@captbd</a> sorry don’t have the computer access at present but that’s what I’m struggling with as I need to extract a string, Concat with a url then pass to image get function</p>
]]></description><link>https://community.m5stack.com/post/17612</link><guid isPermaLink="true">https://community.m5stack.com/post/17612</guid><dc:creator><![CDATA[ajb2k3]]></dc:creator><pubDate>Mon, 30 May 2022 13:38:37 GMT</pubDate></item><item><title><![CDATA[Reply to Trouble passing decoded json to variable on Sat, 28 May 2022 14:40:58 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/443">@ajb2k3</a></p>
<p dir="auto">With this code I can get the data into the esp32.<br />
<img src="/assets/uploads/files/1653748694917-49007088-8126-4adf-9782-3ebfa8341471-screen-shot-2022-05-28-at-7.35.37-am-resized.png" alt="0_1653748693106_49007088-8126-4adf-9782-3ebfa8341471-Screen Shot 2022-05-28 at 7.35.37 AM.png" class=" img-fluid img-markdown" /> Screen Shot 2022-05-28 at 7.35.37 AM.png</p>
<p dir="auto">I cannot, however, decode it into a variable.  I know the get function has worked because I can lcd.print the data either as the raw_channel_stats variable or the decoded_channel_stats variable.  Beyond that I am lost.</p>
]]></description><link>https://community.m5stack.com/post/17600</link><guid isPermaLink="true">https://community.m5stack.com/post/17600</guid><dc:creator><![CDATA[captbd]]></dc:creator><pubDate>Sat, 28 May 2022 14:40:58 GMT</pubDate></item><item><title><![CDATA[Reply to Trouble passing decoded json to variable on Fri, 27 May 2022 09:17:19 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/19861">@captbd</a> this is what I'm trying but getting ENOent</p>
<pre><code>from m5stack import *
from m5stack_ui import *
from uiflow import *
import json

screen = M5Screen()
screen.clean_screen()
screen.set_screen_bg_color(0xFFFFFF)
json = None

#label0 = M5Label('Text', x=5, y=1, color=0x000, font=FONT_MONT_14, parent=None)

#jsondata = json.loads('https://community.m5stack.com/api/users/******.json')
with open ("https://community.m5stack.com/api/users/******.json", "r") as f:
  data = json.loads(f)
  label0 = M5Label(data.items())

</code></pre>
<p dir="auto">Unfortunately it looks like the <strong>with open</strong> function is not implemented ???</p>
]]></description><link>https://community.m5stack.com/post/17581</link><guid isPermaLink="true">https://community.m5stack.com/post/17581</guid><dc:creator><![CDATA[ajb2k3]]></dc:creator><pubDate>Fri, 27 May 2022 09:17:19 GMT</pubDate></item><item><title><![CDATA[Reply to Trouble passing decoded json to variable on Fri, 27 May 2022 07:02:55 GMT]]></title><description><![CDATA[<p dir="auto">Sorry, this won't be immediately useful for you but I am working on a project doing the same thing but I'm away for a week and so won't be able to do much work or study on it.</p>
]]></description><link>https://community.m5stack.com/post/17579</link><guid isPermaLink="true">https://community.m5stack.com/post/17579</guid><dc:creator><![CDATA[ajb2k3]]></dc:creator><pubDate>Fri, 27 May 2022 07:02:55 GMT</pubDate></item></channel></rss>