Skip to content

Add toRawJson support - #193

Merged
mattfarina merged 2 commits into
Masterminds:masterfrom
Dean-Coakley:toJsonRaw-support
Oct 2, 2019
Merged

mattfarina merged 2 commits into
Masterminds:masterfrom
Dean-Coakley:toJsonRaw-support

Conversation

@Dean-Coakley

Copy link
Copy Markdown
Contributor

Fixes: #165

Added:

  • toRawJson
  • mustToRawJson

// The toRawJson function encodes an item into JSON string with HTML characters unescaped.

I also tried to add a toPrettyRawJson func, just by adding enc.SetIndent("", " ")
However I met an issue I was unable to resolve.

Expected '{
          "bool": true,
          "html: "<HEAD>",
          "number": 42,
          "string": "test"
        }', got '{
          "bool": true,
          "html": "<HEAD>",
          "number": 42,
          "string": "test"
        }'

Not sure if that func is of use anyway. Happy to take guidance. Or merge without.

@mattfarina
mattfarina merged commit 9c496df into Masterminds:master Oct 2, 2019
@Dean-Coakley
Dean-Coakley deleted the toJsonRaw-support branch October 2, 2019 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add toJson function that does not escape < and >

2 participants