Skip to content

Rule.io SDK


Rule.io SDK / rcml/src / jsonToEmailRfm

Function: jsonToEmailRfm()

jsonToEmailRfm(json): string

Defined in: rcml/src/email/json-to-email-rfm.ts:35

Convert an RCML content JSON document back to an Email RFM markdown string.

Reverse of emailRfmToJson: the output is a valid Email RFM markdown string that, when passed back through emailRfmToJson, produces a JSON document equal to the input.

If the input JSON was originally produced by emailInlineRfmToJson, the output will also be valid Email Inline RFM (it will only contain Email Inline RFM-compatible constructs). In that case prefer the semantically explicit jsonToEmailInlineRfm alias.

Parameters

json

Json

Typed RCML document JSON ({ type: 'doc', content: [...] }).

Returns

string

Email RFM markdown string.

Example

ts
const json = emailRfmToJson('Hello :font[world]{font-weight="bold"}')
const md = jsonToEmailRfm(json)
// md === 'Hello :font[world]{font-weight="bold"}'