Skip to content

jsonToProfileData

jsonToProfileData(jsonData): [string, string][]

Converts a JSON object to an array of tuples for profile data input. Only flat key-value pairs with string values are accepted; complex JSON (e.g., nested objects, arrays) is rejected. No validation is performed on the content of strings.

Parameters

jsonData: Record<string, unknown>

A JSON object with string keys and values (e.g., { pub_name: "Alice", pub_email: "alice@gmail.com" }).

Returns

[string, string][]

An array of tuples with string keys and values (e.g., [["pub_name", "Alice"], ["pub_email", "alice@gmail.com"]]).

Throws

If any value is not a string (e.g., objects, arrays, numbers).

Source

profile/src/Profile.ts:29