# To HTML functions

**URL:** <https://the.fmsoup.org/t/to-html-functions/5558>\
**Category:** MBS Plugins\
**Created:** [July 9, 2026, 8:23am UTC](https://the.fmsoup.org/t/to-html-functions/5558 "2026-07-09T08:23:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![MonkeybreadSoftware](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/monkeybreadsoftware/32/361_2.png) [@MonkeybreadSoftware](https://the.fmsoup.org/u/MonkeybreadSoftware)\
**Post date:** [July 9, 2026, 8:23am UTC](https://the.fmsoup.org/t/to-html-functions/5558/1 "2026-07-09T08:23:31Z")

</div>

We have a few functions in the [MBS FileMaker Plugin](https://www.monkeybreadsoftware.com/filemaker/) to convert things to HTML. That is useful to visualize HTML or JSON. You may convert text, styled text or MarkDown to HTML.

### JSON

We often have to debug our code for web services and display JSON for debugging. There our [JSON.ToHTML](https://www.mbsplugins.eu/JSONToHTML.shtml) function helps a lot. We can pass the JSON and receive some HTML, which we display into a web viewer.

e.g.

`MBS("`[`JSON.ToHTML`](https://www.mbsplugins.eu/JSONToHTML.shtml)`"; "{\"FirstName\": \"John\", \"id\": 123}")`

Returns:

```auto
<html>
<head>
   <meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body>
<div class="JSONObject">
<table border=0 cellpadding=1>
<tr class="odd"><td>FirstName</td>
<td>John</td></tr>
<tr class="even"><td>id</td>
<td>123</td></tr>
</table></div>
</body>
</html>

```

Here is a little script to take some html, convert it to HTML and load it into a web viewer:

`# now make html Set Variable [$html ; Value: MBS( "JSON.ToHTML"; $json)] # and show in web viewer Set Web Viewer [Object Name: "web" ; URL: "data:text/html;charset=utf-8," & $html]`

Which looks like this:

> | FirstName | John |
> | --- | --- |
> | id | 123 |

### XML

Similar to JSON above, you may want to display XML. Our [XML.ToHTML](https://www.mbsplugins.eu/XMLToHTML.shtml) functon builds a HTML with tables to show the various layers in an XML document. All the keys and values show up with indention to show the level. You may use a CSS for odd and even rows to colorize the cell backgrounds.

e.g.

`MBS("XML.ToHTML"; "1234John"; 0; "")`

Returns:

```auto
<html>
<head>
   <meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body>
<h3>test</h3><div class="Elements">
<table border=0 cellpadding=1>
<tr class="odd"><td>id</td>
<td><p>1234</p></td></tr>
<tr class="even"><td>name</td>
<td><p>John</p></td></tr>
</table></div>
</body>
</html>

```

Which looks like this:

> ### test

> | id | |
> | --- | --- |

> 1234

> | name | |
> | --- | --- |

> John

### Styled Text

You may want to have users type some styled text in a field. Later you convert the styled text to HTML with our [Text.TextToHTML](https://www.mbsplugins.eu/TextTextToHTML.shtml) function or GetAsCSS(). Our function does have a few options for the HTML generation.

e.g.

`MBS( "Text.TextToHTML"; "Hello World¶¶Just a test¶¶😀"; 32 + 1 )`

Returns:

```auto
<p>Hello World</p>
<p>
Just a test</p>
<p>
&#128512;</p>

```

Which looks like this:

> Hello World
> 
> Just a test
> 
> 😀

### Text

When you have text and you like to include it in a HTML piece, you need to encode the various special characters. Our [Text.EncodeToHTML](https://www.mbsplugins.eu/TextEncodeToHTML.shtml) function looks for various special characters and does proper escaping. This way you guarantee that all the accents, asian characters or even smileys survive when embedding some text in HTML, e.g. for an email.

e.g.

`MBS( "Text.EncodeToHTML"; "Hast Du Äpfel? 🍎" )`

Returns:

```auto
Hast Du &Auml;pfel? &#127822;

```

Which looks like this:

> Hast Du Äpfel? 🍎

### MarkDown

For MarkDown text, you can use our [Markdown](https://www.mbsplugins.eu/component_MarkDown.shtml) functions to convert to html and show in a web viewer. For this you combine the [MarkDown.Create](https://www.mbsplugins.eu/MarkDownCreate.shtml) function with either the [MarkDown.HTML](https://www.mbsplugins.eu/MarkDownHTML.shtml) function for just the html snippet, or you use the [MarkDown.HTMLDocument](https://www.mbsplugins.eu/MarkDownHTMLDocument.shtml) function to get a full document.

e.g.

```auto
Set Variable [$r ; Value: MBS("MarkDown.Create"; "Text attributes *italic*, **bold** , `monospace`, ~~strikethrough~~.")] 
Set Variable [$html ; Value: MBS("MarkDown.HTMLDocument"; $r)] 
Set Variable [$r ; Value: MBS("MarkDown.Release"; $r)]

```

### From HTML

Sometimes you need the other way around. Parse the HTML into something useful. Our [Text.HTMLtoJSON](https://www.mbsplugins.eu/TextHTMLtoJSON.shtml) parses the HTML using the tidy library and outputs the nodes as JSON. This way you can use [JSON](https://www.mbsplugins.eu/component_JSON.shtml) functions to work on the HTML and read values. Especially [JSON.Query](https://www.mbsplugins.eu/JSONQuery.shtml) and [JSON.Search](https://www.mbsplugins.eu/JSONSearch.shtml) may help here to find values in the parsed HTML.

When you like to convert the html to styled text, we have the [Text.HTMLtoStyledText](https://www.mbsplugins.eu/TextHTMLtoStyledText.shtml) function. It parses the HTML and converts the styles FileMaker supports from HTML tags to something FileMaker can understand. Various CSS rules will not work, but in general it works often fine for HTML from emails with inline styles.
