Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

Text.HTMLtoJSON

Parses HTML and transforms to JSON.

Component Version macOS Windows Linux Server iOS SDK
Text 14.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "Text.HTMLtoJSON"; Input { ; Options } )   More

Parameters

Parameter Description Example Flags
Input The input HTML. "<title>test</title" // missing >
Options The options as JSON object. Optional

Result

Returns JSON or error.

Description

Parses HTML and transforms to JSON.
Sets error log, which can be queried with Text.TidyErrorLog function.

For options, check this website:
https://api.html-tidy.org/tidy/tidylib_api_5.8.0/tidy_quickref.html

Use JSON.Colorize to apply colors if needed.
By default we apply options to use utf-8 for input and output as encoding. Line endings use Char(13) as FileMaker does and we disable the tidy mark for the html header.

Examples

Cleanup HTML:

MBS( "Text.HTMLtoJSON"; "<title>Test" )

Example result:
[ { "tag": "html", "attributes": { "PUBLIC": "" }, "content": null }, { "tag": "html", "attributes": null, "content": [ { "tag": "head", "attributes": null, "content": [ { "tag": "title", "attributes": null, "content": [ "Test\r" ] } ] }, { "tag": "body", "attributes": null, "content": null } ] } ]

See also

Release notes

Blog Entries

This function checks for a license.

Created 21st July 2024, last changed 24th July 2024


Text.FromStyles - Text.IdentifyData