FAQ
I've defined json tags on a struct to omit a number of fields for a certain
purpose (API responses), but now I want to json encode the same struct with
different rules for a something else (memcached serialization. I considered
using gob, but that seems more heavyweight). Is there a way to accomplish
this with an alternative tag name, or some other relatively painless
solution?

Thanks!

Ben

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Kyle Lemons at Oct 4, 2013 at 6:39 pm
    Gob seems more heavyweight? I'd just use gob.

    On Thu, Oct 3, 2013 at 7:11 PM, wrote:

    I've defined json tags on a struct to omit a number of fields for a
    certain purpose (API responses), but now I want to json encode the same
    struct with different rules for a something else (memcached serialization.
    I considered using gob, but that seems more heavyweight). Is there a way to
    accomplish this with an alternative tag name, or some other relatively
    painless solution?

    Thanks!

    Ben

    --
    You received this message because you are subscribed to the Google Groups
    "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Ben at Oct 4, 2013 at 7:06 pm
    Yep, I didn't realize I could use gob without custom GobEncode/GobDecode
    method on each struct. Just using gob now and it works great. Thanks.
    On Friday, October 4, 2013 11:39:00 AM UTC-7, Kyle Lemons wrote:

    Gob seems more heavyweight? I'd just use gob.

    On Thu, Oct 3, 2013 at 7:11 PM, <b...@jellyhq.com <javascript:>> wrote:

    I've defined json tags on a struct to omit a number of fields for a
    certain purpose (API responses), but now I want to json encode the same
    struct with different rules for a something else (memcached serialization.
    I considered using gob, but that seems more heavyweight). Is there a way to
    accomplish this with an alternative tag name, or some other relatively
    painless solution?

    Thanks!

    Ben

    --
    You received this message because you are subscribed to the Google Groups
    "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to golang-nuts...@googlegroups.com <javascript:>.
    For more options, visit https://groups.google.com/groups/opt_out.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedOct 4, '13 at 5:13a
activeOct 4, '13 at 7:06p
posts3
users2
websitegolang.org

2 users in discussion

Ben: 2 posts Kyle Lemons: 1 post

People

Translate

site design / logo © 2022 Grokbase