Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement json/gob interfaces #307

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

lifubang
Copy link

@lifubang lifubang commented Feb 5, 2022

close #306

After this patch, we can use json.Marshal, json.UnMarshal, GobEncode, and GobDecode for a Variant variable.

@guelfey
Copy link
Member

guelfey commented Feb 5, 2022

I'm not 100% convinced of this for multiple reasons:

  1. Variant is only really meant for communication over dbus. Directly storing it or persisting it doesn't seem like a good idea to me; you can still handle that case if really needed using conversions in application code.
  2. It shouldn't be necessary to use maps for representation - String() already returns a string that can be unambiguously parsed back to the same value (which it does by explicitly including the signature if needed).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't marshal a Variant value as JSON
2 participants