turn api json into ufData object
540335
function parse(data){
			var out = {};
        	if(data.type && data.type === 'User'){

        		// map data into ufData format from api json
        		if(data.name && data.name !== '') {out.name = data.name};
        		if(data.username && data.username !== '') {out.nickname = data.username};
        		if(data.blog && data.blog !== '') {
        			if(!out.url) {out.url =[]}
        			out.url.push(data.blog);
        		};
        		if(data.html_url && data.html_url !== '') {
        			if(!out.url) {out.url =[]}
        			out.url.push(data.html_url);
        		};
        		if(data.bio !== null) {out.note = [data.bio]};
        		if(data.location && data.location !== '') {out.label = [data.location]};
				if(data.company && data.company !== '') {out['organization-name'] = [data.company]};
				if(data.avatar_url && data.avatar_url !== '') {out.photo = [data.avatar_url]}; 
				if(data.email && data.email !== '') {out.email = [data.email]};
        		
			}
			return {type: ['h-card'], properties: out};
		}
152461
def _to_api_value(self, attribute_type, value):
        """"""

        if not value:
            return None

        if isinstance(attribute_type, properties.Instance):
            return value.to_api()

        if isinstance(attribute_type, properties.List):
            return self._parse_api_value_list(value)

        return attribute_type.serialize(value)
132136
def _json_to_subscriptions(response_body):
    
    data = json.loads(response_body)
    subscriptions = []
    for subscription_data in data.get("subscriptionList", []):
        subscriptions.append(Subscription().from_json(
            data.get('uwNetID'), subscription_data))

    return subscriptions
846223
def to_api_repr(self):
        
        values = self.values
        if self.array_type == "RECORD" or self.array_type == "STRUCT":
            reprs = [value.to_api_repr() for value in values]
            a_type = reprs[0]["parameterType"]
            a_values = [repr_["parameterValue"] for repr_ in reprs]
        else:
            a_type = {"type": self.array_type}
            converter = _SCALAR_VALUE_TO_JSON_PARAM.get(self.array_type)
            if converter is not None:
                values = [converter(value) for value in values]
            a_values = [{"value": value} for value in values]
        resource = {
            "parameterType": {"type": "ARRAY", "arrayType": a_type},
            "parameterValue": {"arrayValues": a_values},
        }
        if self.name is not None:
            resource["name"] = self.name
        return resource
213217
def load(fp, encoding=None, cls=JSONTreeDecoder, object_hook=None,
         parse_float=None, parse_int=None, parse_constant=None,
         object_pairs_hook=None, **kargs):
    
    return json.load(fp, encoding, cls, object_hook,
         parse_float, parse_int, parse_constant,
         object_pairs_hook, **kargs)
860793
def json_data(self, instance, default=None):
        
        value = self.get(instance)
        if not value:
            return ""
        if callable(value):
            value = value()
        return api.to_iso_date(value, default=default)
768995
function parseJSON(data) {
    var oData;
    try {
        oData = JSON.parse(data);
    } catch (e) {
        return false;
    }
    return oData;
}
931187
private JsonSimple parsedFormData(String oid) {
		// Get our data from Storage
		Payload payload = null;
		try {
			DigitalObject object = storage.getObject(oid);
			payload = getDataPayload(object);
		} catch (StorageException ex) {
			log.error("Error accessing object '{}' in storage: ", oid, ex);
			return null;
		}

		// Parse the JSON
		try {
			try {
				return FormDataParser.parse(payload.open());
			} catch (IOException ex) {
				log.error("Error parsing data '{}': ", oid, ex);
				return null;
			} finally {
				payload.close();
			}
		} catch (StorageException ex) {
			log.error("Error accessing data '{}' in storage: ", oid, ex);
			return null;
		}
	}
1118554
def dump(obj, fp, **user_kwargs):
    
    return json.dump(obj, fp, **_encoder_kwargs(user_kwargs))
758509
def to_json(obj):
    """"""
    i = StringIO.StringIO()
    w = Writer(i, encoding='UTF-8')
    w.write_value(obj)
    return i.getvalue()
939079
def json_data(self, instance, default=None):
        
        value = self.get(instance)
        if value and self.is_multi_valued():
            return map(api.get_url_info, value)
        elif value and not self.is_multi_valued():
            return api.get_url_info(value)
        return value or default
1190896
function dataURItoBlob(dataURI) {
  // convert base64/URLEncoded data component to raw binary data held in a string
  var byteString;
  if (dataURI.split(',')[0].indexOf('base64') >= 0)
    byteString = atob(dataURI.split(',')[1]);
  else
    byteString = unescape(dataURI.split(',')[1]);

  // separate out the mime component
  var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];

  // write the bytes of the string to a typed array
  var ia = new Uint8Array(byteString.length);
  for (var i = 0; i < byteString.length; i++) {
    ia[i] = byteString.charCodeAt(i);
  }

  return new Blob([ia], {
    type: mimeString
  });
}
913763
def to_json_serializable(obj):
    
    if isinstance(obj, Entity):
        return obj.to_json_dict()

    if isinstance(obj, dict):
        return {k: to_json_serializable(v) for k, v in obj.items()}
    elif isinstance(obj, (list, tuple)):
        return [to_json_serializable(v) for v in obj]
    elif isinstance(obj, datetime):
        return obj.strftime('%Y-%m-%d %H:%M:%S')
    elif isinstance(obj, date):
        return obj.strftime('%Y-%m-%d')

    return obj
1302303
function toJSON(unfilteredOptions) {
        const options = ghostBookshelf.Model.filterOptions(unfilteredOptions, 'toJSON');
        options.omitPivot = true;

        // CASE: get JSON of previous attrs
        if (options.previous) {
            const clonedModel = _.cloneDeep(this);
            clonedModel.attributes = this._previousAttributes;

            if (this.relationships) {
                this.relationships.forEach((relation) => {
                    if (this._previousRelations && this._previousRelations.hasOwnProperty(relation)) {
                        clonedModel.related(relation).models = this._previousRelations[relation].models;
                    }
                });
            }

            return proto.toJSON.call(clonedModel, options);
        }

        return proto.toJSON.call(this, options);
    }
302040
def _read_json(fn_json):
    """"""
    is_json = set()
    is_db = {}
    with open(fn_json) as handle:
        data = json.load(handle)
        # original Py 2.y core
        #for item in data[0].values():
        #    seqs_name = map(lambda (x): x.keys(), item['seqs'])
        # rewrite by 2to3
        for item in list(data[0].values()):
            seqs_name = [list(x.keys()) for x in item['seqs']]
            db_name = item['valid'] if "valid" in item else None
            [is_json.add(name[0]) for name in seqs_name]
            if db_name:
                [is_db.update({name[0]: ",".join(db_name)}) for name in seqs_name]
    return is_json, is_db
924189
def toJson(self, data=None, pretty=False):
        """"""
        if data==None: data = self.attrs
        data = self.flatten(data) # don't send objects as str in json
        #if pretty:
        ret = json.dumps(data, indent=4, sort_keys=True)
        #self.inflate() # restore objects from json str data
        return ret
387218
def api_request(action, data, request_type, binary_key = nil)
      if !binary_key.nil?
        binary_key_data = data[binary_key]
        data.delete(binary_key)
      end

      if data[:format].nil? || data[:format] == 'json'
        data = prepare_json_payload(data)
      else
        data[:api_key] = @api_key
        data[:format] ||= 'json'
        data[:sig] = get_signature_hash(data, @secret)
      end

      if !binary_key.nil?
        data[binary_key] = binary_key_data
      end
      _result = http_request(action, data, request_type, binary_key)

      # NOTE: don't do the unserialize here
      if data[:format] == 'json'
        begin
          unserialized = JSON.parse(_result)
          return unserialized ? unserialized : _result
        rescue JSON::JSONError => e
          return {'error' => e}
        end
      end
      _result
    end