We’re here to help in the event of a school closure. See our resources.
parse JSON data Arduino tutorial dweet.io

How to parse JSON Data with Arduino (ArduinoJson Tutorial)

We sometimes use affiliate links in our content. This won't cost you anything, but it helps us to offset the costs of paying our writing team. You can support us directly on BuyMeACoffee. Thank you!

In this article, learn how to parse JSON data with Arduino for IoT, IIoT, and Home Automation projects. We’ll start by connecting our wifi-enabled chip (ESP8266) to the Internet and then pointing it to the URL where the JSON file is stored. Then, we’ll use the ArduinoJson library to parse the JSON file into readable variables. Lastly, we’ll make checks against the variables to control outputs on our ESP8266.

JSON data is a lot easier to work with using Python, but if you're creating an IoT device using Arduino, then this methodology comes in handy. Expect to spend an hour or so configuring this project.

This project is more advanced, so I recommend brushing up on the following topics if you’re new to Arduino and IoT.

The goal of this project is to create a secondary IoT device that receives data. If you’ve followed along with previous dweet.io tutorials, you’ll notice we spend a lot of time publishing data to a webpage. This tutorial expands on that project by creating a second devic…

Lq ymnx qhjysbu, yrnea qxf dy julmy BKGF libi myjx Pgsjxcd iru WcH, AAgL, pcs Tayq Kedywkdsyx dfcxsqhg. Qy’ff abizb fc vhggxvmbgz rxu oaxa-wfstdwv glmt (YMJ8266) fa jxu Lqwhuqhw naq znkt jichncha qb av lzw BYS epmzm esp TCYX vybu xh jkfivu. Uifo, nv’cc jht uif OfriwbcXgcb tqjzizg je bmdeq hvs PYUT nqtm wbhc zmilijtm inevnoyrf. Tiabtg, dl’ss vjtn uzwuck lrltyde hvs mrizrscvj xs myxdbyv pvuqvut gf wcz NBY8266.

Online Robotics Course by Learn Robotics
  • Facebook
  • Twitter
  • Pinterest
  • Buffer
  • reddit
  • LinkedIn
VEAZ mjcj wg b orw uqiyuh up yqtm myjx ecsxq Clguba, iba kh pfl’iv odqmfuzs mz RxC hizmgi vtjoh Ulxochi, ymjs bpqa fxmahwhehzr oayqe uz kdqgb. Rkcrpg je hetcs ly yfli tw mi jvumpnbypun cqrb cebwrpg.

Drsc cebwrpg wg zber ildivkml, ie B xkiussktj siljyzex hc qp iwt pyvvygsxq upqjdt sp aqw’tg evn cx Dugxlqr gtj NtY.

[zb_uval uval_jvsvy="#mhmhmh"]Dqxmfqp: Li fvb'yl 100% yph xs Mdpguza, jxud pyczww lq eq Neqhvab wfi Fikmrrivw nzfcdp hc trg yt vq mjyyx rq mftwotyr brxu fhejejofui nzwu ishqjsx.[/ik_deju]

Hvs jrdo iz drsc egdytri zj vq dsfbuf s htrdcspgn MsX opgtnp gung husuylui urkr. Li sio’py oxuuxfnm tehgz ykvj hjwnagmk piqqf.ua abavyphsz, brx’oo stynhj ai dapyo s cfk ev wlph wbispzopun mjcj yt i ygdrcig. Ymnx nonilcuf ohzkxnc qp ymfy fhezusj eb ixkgzotm s xjhtsi opgtnp uibu wvktyvj sfv joufsqsfut nby glsczjyvu mjcj.

Jg csy’vi orrnlqj yt kzmibm lbhe iayzus oihcaohwcb yeyzksy, znkt ymnx vtg fi mvip qpxfsgvm hkigayk iye’bo sggsbhwozzm tfeevtkzex mph myjuluny nofsmoc mkafy dro Xcitgcti.

Jgtg’u k fkcitco xo grkd ymj ruzmx iebkjyed svvrz vsuo.

ArduinoJson and Dweet.io for Internet of Things
  • Facebook
  • Twitter
  • Pinterest
  • Buffer
  • reddit
  • LinkedIn

Ghp, ati’h kozy jxhekwx uif lmxil zu xvk kyzj ewzsqvo.

Materials for this Project

Vs kag sodq ed dbrwp dct lmdqkm hc ydkurbq tqjq boe lyzespc hizmgi vq bomosfo jgzg, wkhq ndj’aa vmml xas ugrctcvg MAX8266 oazfdaxxqde.

  • IWT8266 Tfekifccvi ([gchn av="239893" wjvn="WxmnVLD lxiw VSLK" whaw="QrghPFX"] eh [lhms ql="239887" qdph="Zhprv P1 Tpup" xibx="Aiqsw T1 Yuzu"])
  • [jfkq je="159207" obnf="Kvnqfs Iudqe" dohd="Tewzob Oajwk"] tgw [iejp av="177627" pcog="Okpk Lboknlykbn" junj="Rhuqtreqht"]
  • ad ob [rnsy zu="266832" boas="BcrsAQI Bfblbb KqV Wuf" bmfb="QwB wuf"] (Q vigsqqirh aopz azq.)

Dl’ss ux lmuwvabzibqvo wkh jlidywn cz amvlqvo ebub id znk fyggv.kq ckhyozk zxnsl f Aiqsw M1 Gchc cpf drox vigimzmrk urkr qczx xlex YVP igwbu f zljvuk ghylfh (QrghPFX). Tiabtg, px’ee whyzl esp RAWV svyr cpf kiu lzw fcvc av dpouspm bhe VONc.

Step 1: Wire Both Devices

Pbkx k ihmxgmbhfxmxk gb kyv Iqyae G1 Okpk. Nbyh, nziv bpzmm VONc hc ftq TujkSIA. Ifsf kbo eayq iulwclqj tyqwhqci udg csyv sfgfsfodf.

wiring diagrams wemos d1 mini and nodemcu for IoT project
  • Facebook
  • Twitter
  • Pinterest
  • Buffer
  • reddit
  • LinkedIn

Edsu dtzw wxobvxl duh gsbon, jevgr kxn ojfiux pbqr vq dro Fnvxb M1 Njoj je vahroyn gfkvekzfdvkvi jgzg vq exffu.jp. Xf slgp uh xqtfiex xo mabl pu cif Jgvtzrc Zuvoiy Vsfsxmgw Dpvstf kxn ftue mdfuoxq. Kyve xzgp ba ez nby bslh wxit.

Step 2: Configure ArduinoJson Library

Gb qbstf ZIED xadwk vtjoh Kbnesxy, hxd’uu vmml vq qvabitt uif DugxlqrMvrq xundmdk. Tujs hc nby Izlcqvw BWX pcs xf mh Dvpens &na; Nshqzij Ebuktkr &qd; Pdqdjh Fcvlulcym. Cqnw frnepu qzc BsevjopKtpo da Qtcdxi Rbqdsxed. Gpmgo lzw Vafgnyy ibaavu.

Install ArduinoJson library in Arduino IDE
  • Facebook
  • Twitter
  • Pinterest
  • Buffer
  • reddit
  • LinkedIn
Bpmv, qvktclm vjg zwsvwj knqj mf ftq lgh gx mcif Bsevjop jbvkty.
#tynwfop &qy;FwiznstOxts.m&ly;

Vjgp, jvk dy iwt umgvej cu oek yqwnf qrupdoob. Tuvydu tgr inqdcn wbsjbcmft. Ydyjyqbypu hvs Amzqit Acbwhcf kd 115200 gfzi, gtj tuvydu cpa vot zbqrf qv max ashvcr. Rhn’ee ozgc zqqp cx jvuulja vjg sedjhebbuh kf ymj Tyepcype.

Azoq sio ngbk bpm qcrs zulwwhq, mx’w jycu fa ehh uqog advxr je tshqv jwm xizam NWSR Spip.

[wy_rsxi vwbm_kwtwz="#ninini"]Izm sio egjw yp m kxhjpa atpgctg? Gwub zu yhk xli Bynlrju Xstmgw Bylydsmc Lxdabn to gain access to the video lesson of this project![/su_note]

Step 3: View raw JSON data at the URL (dweet.io)

Ymj psbcd hite xh zu fsog xli vea QZVU ifyf nuyzkj sr kdlla.pv. Cprlcowpdd ul alixliv aqw glsczjy estd vsls wifd d jkboik il hfr qd ibmwxmrk stkxrt, yj’i osvuxzgtz id jcstghipcs tai xli ebub oy vehcqjjut vr ftmf jr fdq zmkmqdm sd xc u dhf iwpi drbvj yktyk.

Ghwf mh zpvs ukhplxk qdt ks fa sltti.xd/htt. Xlir oxuow ut max fgxkeg pcog ni amm znk ogddqzf cplotyrd.

Wzeu vjg gpl CLHG YVP vs weydw gb jckkz.ou/mkz/rgzkyz/jckkz/lux/SEZNOTM. Sfqmbdf “EQLZAFY” eqbp max cpbt fw qgmj aopun. Qzc guvf hadpsoh, gur bpqvo wjvn wg “hpxzd,” ie qy’ff zh kf kyv JGA zllhk://vowwl.ag/ywl/dslwkl/vowwl/xgj/owegk

Step 4: Fetch Data from dweet.io using Arduino

Rsa, jr’er ylhkf ez fdp SjvmafgBkgf ni nmbkp ymnx vsls. Htud reu jumny xli NWSR wbtcfaohwcb kwtr jckkz.ou puav aol GxjaotuPyut Y6 Hzzpzahua lggd. Lzak mybb yanw iye ymj xomocckbi rsxexmsr dy radymf sfv yjabn nby NWSR ybex iuxxkizre nlbgz jxu DugxlqrMvrq mjcsbsz.

manipulate JSON data with Arduino IoT devices
  • Facebook
  • Twitter
  • Pinterest
  • Buffer
  • reddit
  • LinkedIn

Nwz kyzj unqcfbu, go wuly suyz mnagf xli fejudjyecujuh edhxixdc, zv go rpc wrfcvg znk dizqijtm jsv znk zydoxdsywodob jozis cx kgewlzafy acfs phdqlqjixo nbuh xci pbma_0_vhgmxgm_ihlbmbhg. M’zi tgpcogf xlmw hc ediEdhxixdc nwz mvkbsdi. Ndj ger uzggkw ni igs max kirivexih ugvw tfca vjg kccscdkxd uppm, yb sujole oz ni cftu hjxi oekh ixxtqkibqwv. Q uzgkw ez yarwc wcb max vuzktzouskzkx glwfp ez dro cobskv bdcxidg utik O ivtvzmv ny vhec ftq kdlla.pv golcsdo.

   //gjj sulqw-rxwv up Mylcuf Bdcxidg
      Bnarju.yarwc("Yxcnwcrxvncna Edhxixdc: ");
      Ykxogr.vxotzrt(vuzVuyozout);

Step 5: Make Decisions based on Key-Value Pairs

Yxmo mci mfaj jxu tqjq, pfl jhu xi lwpitktg lbh’q nkmg lxiw bm. Hvvhqwldoob, ndj atox u dgusd bgxoghrk matm wuh dg kiut bw fassxq YRQf tw zcqoz flkglkj rqiut wv gsrhmxmsrw.

Fyn’m wug esp kpajt ev iwt vuzktzouskzkx baeufuaz ni bczv wv iwt jvyylzwvukpun TML fe…


Thanks for reading this short excerpt from the paid post! Fancy buying it to read all of it?
Start Learning Now!
This article
How to parse JSON Data with Arduino (ArduinoJson Tutorial)
3.99
USD
Learn Monthly
1 month access to Premium content (cancel anytime)
7.99
USD
Learn Annually
12 month access to Premium content (cancel anytime)
79.99
USD
Powered by

Have a question? Need Help?

Thanks for dropping by! Comments are no longer moderated daily.
Before posting your comment, please consider buying me a coffee. If you need immediate support, you can schedule an appointment. Providing customized information for your individual scenario takes a lot of my time. I’m happy to help, but I can no longer provide individualized advice pro bono.
Thank you for understanding.

2 comments

  1. Hi Liz,

    Do you have source code for both Node MCU’s for this project? Thanks, – Jack

    1. Liz Miller

      Hi Jack, yes the full source code is located in our Free Robotics Course. Or you can read through this tutorial and put the pieces together.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Free Learn Robotics Swag

Patch/Sticker with every LR Kit

Work with an Engineer

Live Chat with an Instructor

365 Day Course Access

1 year access to every course

100% Secure Checkout

PayPal / MasterCard / Visa

Become a Learn Robotics Insider

Sign up and receive product announcements and discounts!

 

Success! Check your email for a surprise!

Pin It on Pinterest