<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/18841" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2012-05-01T16:04:23-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/18841</id>

		<entry>
		<author><name><![CDATA[elbandido]]></name></author>
		<updated>2012-05-01T16:04:23-04:00</updated>

		<published>2012-05-01T16:04:23-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99312#p99312</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99312#p99312"/>
		<title type="html"><![CDATA[json2dict help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99312#p99312"><![CDATA[
Solved:<div class="codebox"><p>Code: </p><pre><code>[lindex [lindex $json_data 0] 0]</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11984">elbandido</a> — Tue May 01, 2012 4:04 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2012-05-01T15:50:14-04:00</updated>

		<published>2012-05-01T15:50:14-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99311#p99311</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99311#p99311"/>
		<title type="html"><![CDATA[json2dict help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99311#p99311"><![CDATA[
As I said in my previous post, the json-data you posted will translate to a list of dicts... Use <em class="text-italics">lindex</em> or <em class="text-italics">foreach</em> to extract the dict(s) from the list before using the dict-command on it/them.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Tue May 01, 2012 3:50 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[elbandido]]></name></author>
		<updated>2012-05-01T15:45:20-04:00</updated>

		<published>2012-05-01T15:45:20-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99309#p99309</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99309#p99309"/>
		<title type="html"><![CDATA[json2dict help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99309#p99309"><![CDATA[
yes, like this:<br><div class="codebox"><p>Code: </p><pre><code>package require httppackage require jsonbind pub * .search searchproc search {nick uhost hand chan argv} {variable url0 "xxx"set url "${url0}${argv}/1.json?key=xxxxx"set json_data [::json::json2dict [::http::data [::http::geturl $url]]]}</code></pre></div>I want to extract first value for "id" from json data above.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11984">elbandido</a> — Tue May 01, 2012 3:45 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2012-05-01T09:46:47-04:00</updated>

		<published>2012-05-01T09:46:47-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99307#p99307</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99307#p99307"/>
		<title type="html"><![CDATA[json2dict help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99307#p99307"><![CDATA[
@elbandido:<br>First off, did you convert your json-data to a tcl-list/dict collection using the <em class="text-italics">json::json2dict</em> command?<br>Secondly, your set of data will return a list of dicts, so you'll either have to iterate through each of them using <em class="text-italics">foreach</em>, or select a specific index using <em class="text-italics">lindex</em> before using <em class="text-italics">dict</em> to get the id property.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Tue May 01, 2012 9:46 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[elbandido]]></name></author>
		<updated>2012-05-01T02:11:16-04:00</updated>

		<published>2012-05-01T02:11:16-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99306#p99306</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99306#p99306"/>
		<title type="html"><![CDATA[dict with list]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99306#p99306"><![CDATA[
I'm trying to extract id or name from this json source:<br><div class="codebox"><p>Code: </p><pre><code>[{"id":2020512,"name":"Romper"},{"id":5882783,"name":"Romper amante"},{"id":5630419,"name":"Romper the last"},{"id":5630428,"name":"Romper the Last II"},{"id":5465877,"name":"Romper5"}]</code></pre></div>[dict get $json_data id] seems to not working, any help regarding that?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11984">elbandido</a> — Tue May 01, 2012 2:11 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[johne]]></name></author>
		<updated>2012-02-15T16:53:34-04:00</updated>

		<published>2012-02-15T16:53:34-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=98806#p98806</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=98806#p98806"/>
		<title type="html"><![CDATA[json2dict help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=98806#p98806"><![CDATA[
worked great! thx!<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6497">johne</a> — Wed Feb 15, 2012 4:53 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2012-02-15T15:39:12-04:00</updated>

		<published>2012-02-15T15:39:12-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=98804#p98804</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=98804#p98804"/>
		<title type="html"><![CDATA[json2dict help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=98804#p98804"><![CDATA[
Looking at the json-data shows that the watched-element contains a tcl-list, not a dict. Considder using something along these lines (assuming $source contains the json-source)<div class="codebox"><p>Code: </p><pre><code>set mydict [json::json2dict $source]foreach show [dict get $mydict watched] {  putlog "title: [dict get $show show title]"}</code></pre></div>or<div class="codebox"><p>Code: </p><pre><code>set mydict [json::json2dict $source]putlog "title: [dict get [lindex [dict get $mydict watched] 0] show title]"</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Wed Feb 15, 2012 3:39 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[johne]]></name></author>
		<updated>2012-02-15T14:12:04-04:00</updated>

		<published>2012-02-15T14:12:04-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=98801#p98801</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=98801#p98801"/>
		<title type="html"><![CDATA[json2dict help]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=98801#p98801"><![CDATA[
i'm trying to pull [dict get $data watched show title] from the data below after using json2dict. what am I missing to pull the watched data via dict or is there a better way?<br><br><a href="http://pastebin.com/AEk3feYz" class="postlink">http://pastebin.com/AEk3feYz</a><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6497">johne</a> — Wed Feb 15, 2012 2:12 pm</p><hr />
]]></content>
	</entry>
	</feed>
