Golang a nice library for working with JSON Go-dproxy

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.
                                                                                                     

Photo from: http://qiita.com/hogedigo/items/f914992baf7a2ed12b9c


National Day seven days, you eat more, or sleep more? Holiday seven days is fleeting, the next seven days you may feel very diffuse.


Anyway Golang has a library of JSON (Encoding/json) processing, and a third-party Simplejson(Https://github.com/bitly/go-simplejson). But it's always easier to feel like a dynamic language like Python, in Python, arrays and dictionaries are easy to handle, and JSON is easy to transfer.


The biggest problem with Encoding/json is that it is not flexible enough to pre-define a lot of structs to encode and decode, which is very inconvenient for processing JSON files with variable structure.


Here is a library called Go-dproxy(Https://github.com/koron/go-dproxy), which is very convenient and simple, does not require a pre-defined struct, and can be looked up like XPath.


Here is an example:




or download this file from gist(https://gist.github.com/liubin/5521035cb9dab26e5981549b2cea355a) to perform:


$ go Get github.com/koron/go-dproxy

$ go Build dproxy-test.go

$./dproxy-test


Can.



In short, this library processing JSON should be very simple, I hope to help you.


Click to read the original version can see the PC Edition.



Have good things to share





View Original: http://www.zoues.com/2016/10/20/golang%e4%b8%ad%e4%b8%80%e4%b8%aa%e4%b8%8d%e9%94%99%e7%9a%84%e5%a4%84%e7% 90%86-json-%e7%9a%84%e5%ba%93-go-dproxy/
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.