Skip to content

How should I handle json serialization of ListConfig objects? #618

Answered by jgbos
jeffliu-LL asked this question in Q&A
Discussion options

You must be logged in to vote

Ah, this one gets me too. Unfortunately Hydra converts lists to a omegaconf.ListConfig object and does not convert it to list on instantiation. There are two options for you:

  1. Convert the object to list: json.dumps(list(list_obj))
  2. Use the convert all flag for Hydra instantiate: json_config = builds(json_serialize_func, ['test', 'item'], hydra_convert="all")

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@jeffliu-LL
Comment options

@rsokl
Comment options

@jgbos
Comment options

@rsokl
Comment options

Answer selected by jeffliu-LL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants