How to Parse JSON With Simple C Code Using JSMN and Steem Block 2M by Bryan Gmyrek Ph.D.steemCreated with Sketch.

in #beyondbitcoin8 years ago (edited)



Today I made a video tutorial to show you how to parse JSON with simple C, as well as some other fun things such as how to step through debug C code on Mac OS X with CLion.



The inspiration for this was that I was reading @faddat’s great post about JSON and Steemit. I had also been looking into a simple, portable, tool to parse JSON from C called JSMN.


1_wtf_is_json_series__ingestron_-__steemjson__making_steem_a_universal_json-storage_blockchain_step_by_step_-_steemit

Why is it useful to be able to do this? As @faddat says “It [the JSON for the Steem block] contains all the information that’s needed to use STEEM’s 2,000,000th block. Posts, upvotes, everything.” Sounds useful. Let’s assume you want to get this info from C and you need a simple, reliable, fast, portable way to do it.


2the_most_simple_json_parser_in_c_for_small_systems

I thought you might find it useful if I combined these things and made a few tutorial videos, so here they are. I’ve added some screenshots below these to give you a taste of what you’ll see also.


How to Parse JSON With Simple C Code Video Part 1 (~10 min)

Topics: Introduction. Steem & JSON. JSMN C parser. CLion IDE. Makefiles.




How to Parse JSON With Simple C Code Video Part 2 (~10 min)

Topics: Make and run the steem_block.c example. Debug configurations for make projects in CLion – tips and tricks. Building a Makefile project successfully in CLion for Debugging.




How to Parse JSON With Simple C Code Video Part 3 (~10 min)

Topics: Stepping through the steem_block.c and JSMN example code. Debugger tips: inspecting variables, break points, stepping in/out/over code, etc. Final summary and plug of my blog.




Screenshots

How to Make Stuff


The Steem Block JSON is Inside the C Code!



Why? Because. That's why.

Witness step through debugging in action.



If you learned nothing else from the videos, I hope you learned that step through debugging rocks.

Join the fight. Learn step through debugging. Go INSIDE THE COMPTUER(sic)

Let's allow Zoolander and Hansel illustrate how frustrating it can be to not know how to step through debug.



(Contrary to popular belief, I am not Owen Wilson's other brother.)

This is what happens when you don't take the time to learn effective debugging skills.



Don't let this happen to you. Learn effective step through debugging. Watch the tutorials.

I hope you found these videos useful and have a great one!

Bryan Gmyrek aka @nonlinearone

Credits: All images and videos (except for Zoolander - I'm not that funny) were created by the author.

Simulposting: This post was simulcast (or, as I like to call it, simulposted(TM)) on my BryanGmyrek.com blog at.

About the Author

photo-on-9-12-16-at-8-29-pm-2

Bryan Gmyrek is a full time software developer and lives in sunny Arizona with his beautiful wife, three sons and two golden puppies. He holds a Ph.D. in physics from the University of Arizona based on the particle physics research he did at the world famous DZero Experiment at the Fermi National Accelerator Laboratory. He has been administering web servers for over fifteen years and has worked full time at a server security automation company and at a webhosting company. He has been online since 1993, into cryptocurrencies since 2013, won prizes at three Bitcoin hackathons, and co-organizes the highly technical Blockchain Meetup in Phoenix Arizona for over a year. Many of his videos are popular on YouTube, including his recent SteemIt technical talk. He also blogs about nature photography, dogs, national parks and hiking. Pay no attention to that Tardis. Read more in my top 50 introduceyourself post

Pay me 100% in Steem Power

Bryan has powered up almost everything he has earned on SteemIt, including a single power up of nearly 2,000 STEEM DOLLARS from his introduceyourself post. Please support those who support SteemIt. Thank you.

Join My Newsletter

Email “decentralize thoughts” to [email protected] to join my new newsletter about decentralized technologies, programming, nature, and more.

Follow me @nonlinearone

Check Out My Next Post
In which I explain why comments are disabled for these YouTube videos.


Stop YouTube Trolls Dead in Their Tracks. Tell Them to Leave Feedback on SteemIt.

p.s. I'm thinking about throwing my hat in the ring as a Steem witness. Just a heads up as I know a lot of preparation is necessary. Please let me know if you would consider supporting me in this important role (see the about me above). Thanks!

Sort:  

You got my vote as witness

Thanks for the effort and time to share this with others. This will be useful for many. Also thanks for being a Steemit supporter and Powering Up to keep things in the system and help it grow.

Take care. Peace. Upped and added you as a witness vote.

Thanks @krnel :)
I try to do "no holds barred" tutorials.
Instead of glossing over the hard stuff, I try to show people what they need to do in order to make real stuff work.
Glad you think it'll be useful and have a nice one.

So, when you write C, you use intellij?

I recently found this:
https://cgogen.com/

I certainly plan to use it :).

Coin Marketplace

STEEM 0.20
TRX 0.13
JST 0.030
BTC 65762.16
ETH 3485.95
USDT 1.00
SBD 2.50