what should i be using for encoder in the ListSeri...
# serialization
j
what should i be using for encoder in the ListSerializer?
Copy code
ListSerializer(ListingStateVO.serializer()).serialize(
				encoder = ???,
				value = it
			)
r
It’ll vary depending on what format you’re serializing to (JSON, proto, etc). Though, usually you won’t call
serialize()
directly but instead a function like
Json.stringify()
which configures an
Encoder
internally.
Any function that you might have passed
ListingStateV0.serializer()
to for an object, you could also pass
ListSerializer(ListingStateVO.serializer())
for a list.
j
Json.stringify is deprecated in 1.4 rc
Copy code
Json.encodeToString(ListingStateVO.serializer(), it)
expects a single item, not a list
r
Json.encodeToString(ListSerializer(ListingStateVO.serializer()), list)
metal 1
j
thanks for the info!