Warning: mysqli::__construct(): (HY000/1203): User howardkn already has more than 'max_user_connections' active connections in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\includes\artfuncs.php on line 21
Failed to connect to MySQL: (1203) User howardkn already has more than 'max_user_connections' active connections
Warning: mysqli::query(): Couldn't fetch mysqli in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\index.php on line 66
Article <20240508162146.61cfc58f4140a4a0074adab1@g{oogle}mail.com>
Deutsch   English   Français   Italiano  
<20240508162146.61cfc58f4140a4a0074adab1@g{oogle}mail.com>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Anton Shepelev <anton.txt@g{oogle}mail.com>
Newsgroups: comp.lang.c
Subject: Re: Which newsgroup for json parsing?
Date: Wed, 8 May 2024 16:21:46 +0300
Organization: A noiseless patient Spider
Lines: 54
Message-ID: <20240508162146.61cfc58f4140a4a0074adab1@g{oogle}mail.com>
References: <la1bjoF2anmU1@mid.individual.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 08 May 2024 15:21:49 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="3e46c2e5a630b9fb6021d55d81c4dce2";
	logging-data="4187692"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX189sKBUDQ1aUS8Mrn8ZltbhRBU/ukE+Whg="
Cancel-Lock: sha1:m6edpK5kY/UDgs7PDAuNlEwOdg8=
X-Newsreader: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32)
Bytes: 2625

Josef Mollers:

> I am trying to parse a json string received through MQTT
> from a "Shelly Plug S", e.g.
>
> {"id":0,
>  "source" : "button",
>  "output" : true,
>  "apower" : 0.0,
>  "voltage": 237.9,
>  "current": 0.000,
>  "aenergy":{
>   "total"    : 0.000,
>   "by_minute": [0.000,0.000,0.000],
>   "minute_ts": 1715172119},
>  "temperature":{
>   "tC": 41.1,
>   "tF": 106.0}}

I have reformatted your example, because it was a mess.
JSON is so easy to parse, that writing your own parser may
prove an interesting exercise for a couple of days.  I used
the following site for reference:

  <https://www.json.org/json-en.html>

> I am trying to use libjson-glib but I can't figure out
> what to use as the first argument to
> json_gobject_from_data()!

Have you checked the documentation?--

  <https://gnome.pages.gitlab.gnome.org/json-glib/func.gobject_from_data.html>

Additionally, the WIKI page has some examples:

  <https://wiki.gnome.org/Projects/JsonGlib>

> I am also looking at libjson-c but cannot find any
> examples that could guide me.

Have you checked the documentation?--

  <http://json-c.github.io/json-c/json-c-current-release/doc/html/index.html#using>

Observe that examples are optional in that they illustrate
documentation rather then provide it.  It is better to learn
from first principles than from examples.  See also:

  <http://json-c.github.io/json-c/json-c-current-release/doc/html/index.html#gettinghelp>

-- 
()  ascii ribbon campaign -- against html e-mail
/\  www.asciiribbon.org   -- against proprietary attachments