<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >JSON Type</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REV="MADE" HREF="mailto:pgsql-docs@postgresql.org"><LINK REL="HOME" TITLE="PostgreSQL 9.2.13 Documentation" HREF="index.html"><LINK REL="UP" TITLE="Data Types" HREF="datatype.html"><LINK REL="PREVIOUS" TITLE="XML Type" HREF="datatype-xml.html"><LINK REL="NEXT" TITLE="Arrays" HREF="arrays.html"><LINK REL="STYLESHEET" TYPE="text/css" HREF="stylesheet.css"><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"><META NAME="creation" CONTENT="2015-06-13T20:07:41"></HEAD ><BODY CLASS="SECT1" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="5" ALIGN="center" VALIGN="bottom" ><A HREF="index.html" >PostgreSQL 9.2.13 Documentation</A ></TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="top" ><A TITLE="XML Type" HREF="datatype-xml.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="10%" ALIGN="left" VALIGN="top" ><A HREF="datatype.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="60%" ALIGN="center" VALIGN="bottom" >Chapter 8. Data Types</TD ><TD WIDTH="20%" ALIGN="right" VALIGN="top" ><A TITLE="Arrays" HREF="arrays.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="SECT1" ><H1 CLASS="SECT1" ><A NAME="DATATYPE-JSON" >8.14. <ACRONYM CLASS="ACRONYM" >JSON</ACRONYM > Type</A ></H1 ><P > The <TT CLASS="TYPE" >json</TT > data type can be used to store JSON (JavaScript Object Notation) data, as specified in <A HREF="http://www.ietf.org/rfc/rfc4627.txt" TARGET="_top" >RFC 4627</A >. Such data can also be stored as <TT CLASS="TYPE" >text</TT >, but the <TT CLASS="TYPE" >json</TT > data type has the advantage of checking that each stored value is a valid JSON value. There are also related support functions available; see <A HREF="functions-json.html" >Section 9.15</A >. </P ><P > <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > allows only one server encoding per database. It is therefore not possible for JSON to conform rigidly to the specification unless the server encoding is UTF-8. Attempts to directly include characters which cannot be represented in the server encoding will fail; conversely, characters which can be represented in the server encoding but not in UTF-8 will be allowed. <TT CLASS="LITERAL" >\uXXXX</TT > escapes are allowed regardless of the server encoding, and are checked only for syntactic correctness. </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="datatype-xml.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="arrays.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><ACRONYM CLASS="ACRONYM" >XML</ACRONYM > Type</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="datatype.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Arrays</TD ></TR ></TABLE ></DIV ></BODY ></HTML >