Adds JSON encoding support