Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
30 lines (27 sloc) 869 Bytes
Red [
Title: "JSON codec"
Author: "Gabriele Santilli"
Purpose: "Adds JSON as a valid data type to use with LOAD/AS and SAVE/AS"
Rights: "Copyright (C) 2019 Red Foundation. All rights reserved."
License: {
Distributed under the Boost Software License, Version 1.0.
#include %environment/codecs/json/
#include %environment/codecs/json/
put system/codecs 'json context [
Title: "JSON codec"
Name: 'JSON
Mime-Type: [application/json]
Suffixes: [%.json]
encode: func [data [any-type!] where [file! url! none!]] [
to-json data
decode: func [text [string! binary! file!]] [
if file? text [text: read text]
if binary? text [text: to string! text]
load-json text
You can’t perform that action at this time.