Skip to content

Commit

Permalink
[FEAT](json): parsing of the header json to only get names and values
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien VIGNAU-ESPINE committed Oct 7, 2024
1 parent fa541ea commit 73e0d56
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/content/series/Tags.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,25 @@ const Tags = ({ seriesId }: TagsProps) => {
}
)

const json = JSON.parse(JSON.stringify(header, null, 2))
const json_values = Object.values(json)
var names_list = []
var values_list = []
for (var index = 0; index < json_values.length; index++) {
names_list.push(json_values[index]["Name"])
values_list.push(json_values[index]["Value"])
}

const jsonNameValues = Object.fromEntries(names_list.map((key, index) => [key, values_list[index]]));

if (!instances) return <Spinner />
return (
<>
<Input label="Instance Number" min={1} max={instances.length} value={instanceNumber ?? 1} onChange={(event) => setInstanceNumber(Number(event.target?.value))} />
<pre>
{JSON.stringify(header, null, 2)}
{JSON.stringify(tags, null, 2)}
{JSON.stringify(jsonNameValues, null, 2)}
{JSON.stringify(header, null, 2)}
{/* {JSON.stringify(tags, null, 2)} */}
</pre>
</>
)
Expand Down

0 comments on commit 73e0d56

Please sign in to comment.