<?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/21251" />

	<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>2023-02-28T13:34:28-04:00</updated>

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

		<entry>
		<author><name><![CDATA[geek]]></name></author>
		<updated>2023-02-28T13:34:28-04:00</updated>

		<published>2023-02-28T13:34:28-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=111717#p111717</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=111717#p111717"/>
		<title type="html"><![CDATA[extract json data]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=111717#p111717"><![CDATA[
very useful<br><br>tnx<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10286">geek</a> — Tue Feb 28, 2023 1:34 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2023-02-28T12:19:52-04:00</updated>

		<published>2023-02-28T12:19:52-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=111716#p111716</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=111716#p111716"/>
		<title type="html"><![CDATA[extract json data]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=111716#p111716"><![CDATA[
You can use an online app like <a href="https://codebeautify.org/jsonviewer" class="postlink">JSON Viewer</a> as well. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Tue Feb 28, 2023 12:19 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[geek]]></name></author>
		<updated>2023-02-27T13:59:56-04:00</updated>

		<published>2023-02-27T13:59:56-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=111715#p111715</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=111715#p111715"/>
		<title type="html"><![CDATA[extract json data]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=111715#p111715"><![CDATA[
yes it works<br><br>thanks SpiKe^^ and caesar<br><br><br>I found a picture of how data is formatted:<br><br><img src="https://digilander.libero.it/luca.dm/images/json.png" class="postimage" alt="Image"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10286">geek</a> — Mon Feb 27, 2023 1:59 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2023-02-28T12:20:51-04:00</updated>

		<published>2023-02-27T13:29:25-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=111714#p111714</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=111714#p111714"/>
		<title type="html"><![CDATA[extract json data]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=111714#p111714"><![CDATA[
Add a string map like:<div class="codebox"><p>Code: </p><pre><code>set todaytext [string map {\n {}} [dict get [lindex [dict get $jdict choices] 0] text]]</code></pre></div>to remove the new lines.<br><br>Edit: Typo, it's string not strong map. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_lol.gif" width="15" height="15" alt=":lol:" title="Laughing"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Mon Feb 27, 2023 1:29 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[SpiKe^^]]></name></author>
		<updated>2023-02-27T12:45:12-04:00</updated>

		<published>2023-02-27T12:45:12-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=111713#p111713</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=111713#p111713"/>
		<title type="html"><![CDATA[json=&gt;list=&gt;json fix?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=111713#p111713"><![CDATA[
That json data is somewhat odd, keeping the easiest plans from working:)<br><br>Let us assume you have that data you posted above saved in a variable named  $jsondata<br><br>I might use something like this...<div class="codebox"><p>Code: </p><pre><code>package require jsonset jdict [::json::json2dict $jsondata]set todaytext [dict get [lindex [dict get $jdict choices] 0] text]</code></pre></div>The value I think you seek should be saved in  $todaytext<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7749">SpiKe^^</a> — Mon Feb 27, 2023 12:45 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[geek]]></name></author>
		<updated>2023-02-27T07:37:43-04:00</updated>

		<published>2023-02-27T07:37:43-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=111712#p111712</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=111712#p111712"/>
		<title type="html"><![CDATA[extract json data]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=111712#p111712"><![CDATA[
hi,<br>I need help to handle the result of a [::http::data $token]<br>I think the data is in json format<br>I get a "structure" like this:<div class="codebox"><p>Code: </p><pre><code>{"id":"cmpl-6oGBZmblablablablai9NTA","object":"text_completion","created":1677436637,"model":"text-davinci-003","choices":[{"text":"\n\nYes, today is Monday.","index":0,"logprobs":null,"finish_reason":null}],"usage":{"prompt_tokens":4,"completion_tokens":8,"total_tokens":12}}</code></pre></div>and I want to extract the text field "\n\nYes, today is Monday."<br><br>how can I do?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10286">geek</a> — Mon Feb 27, 2023 7:37 am</p><hr />
]]></content>
	</entry>
	</feed>
