Menu

active is not a CSV column. It stays inside meta
📰

active is not a CSV column. It stays inside meta

DEV Community: typescript·Ameen Usman·1 day ago
#aumzXLgW
#devtotypescript#devto#dev#meta#active
Reading 0:00
15s threshold

I expected active to become its own CSV header. It did not. The JSON converter keeps top-level keys only. A nested object is one cell of JSON text, with inner quotes doubled so the row stays valid CSV. Parsing and conversion stay in the browser. Nothing is uploaded.

What the sample actually prints

This is the Sample button array on the page:

[ { "id" : 1 , "name" : "Ada" , "role" : "engineer" , "meta" : { "active" : true } } , { "id" : 2 , "name" : "Linus" , "role" : "founder" , "meta" : { "active" : false } } ]

Enter fullscreen mode

Exit fullscreen mode

CSV output:

id,name,role,meta 1,Ada,engineer,"{""active"":true}" 2,Linus,founder,"{""active"":false}"

Enter fullscreen mode

Exit fullscreen mode

active sits inside meta , so it is not a header. An array value is also one cell. {"id":1,"tags":[]} converts to a tags cell of [] .

The same nest is not flat in TypeScript

TypeScript drafts from the first object only. Nested meta becomes a second interface.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.