fromJson

View as MarkdownOpen in Claude

Static factory that reconstructs a PromptObjectModel from JSON data. Use this to restore a model serialized via toJson().

Parameters

jsonData
string | unknownRequired

Either a JSON string or an already-parsed array of section data objects. A string is parsed with JSON.parse(); anything else is used directly.

Returns

PromptObjectModel — A new model populated from the supplied data.

Example

1import { PromptObjectModel } from '@signalwire/sdk';
2
3const data = [
4 { title: 'Intro', body: 'Welcome.' },
5 { title: 'Rules', bullets: ['Be nice.', 'Stay on topic.'] },
6];
7
8const pom = PromptObjectModel.fromJson(data);
9console.log(pom.renderMarkdown());