Helper function to loadResource that adds resources to the
properties parameter by parsing through a json object.
487368
private void loadJsonResource(JSONObject json, Properties properties, Object name)
                                throws JSONException {
    Iterator<?> keys = json.keys();
    while (keys.hasNext()) {
      Object obj = keys.next();
      if (!(obj instanceof String)) {
        LOG.warn("Object not instance of string : " + obj + " skipping");
        continue;
      }
      String key = (String) obj;
      // can't have . in thrift fields so we represent . with _
      String keyUnderscoresToDots = key.replace("_", ".");  
      // actual _ are represented as __ in thrift schema
      keyUnderscoresToDots = keyUnderscoresToDots.replace("..", "_");
      if (!json.isNull(key)) {
        Object value = json.get(key);
        String stringVal = "";
        if (value instanceof String) {
          stringVal = (String)value;
        } else if (value instanceof Integer) {
            stringVal = new Integer((Integer)value).toString();
        } else if (value instanceof Long) {
            stringVal = new Long((Long)value).toString();
        } else if (value instanceof Double) {
            stringVal = new Double((Double)value).toString();
        } else if (value instanceof Boolean) {
            stringVal = new Boolean((Boolean)value).toString();
        } else if (value instanceof JSONObject) {
            loadJsonResource((JSONObject)value, properties, name);
            continue;
        } else {
            LOG.warn("unsupported value in json object: " + value);
        }
        if (!finalParameters.contains(keyUnderscoresToDots)) {
          properties.setProperty(keyUnderscoresToDots, stringVal);
          updatingResource.put(keyUnderscoresToDots, name.toString());
    	} else {
    	    LOG.warn(name+":a attempt to override final parameter: "+
                     keyUnderscoresToDots+";  Ignoring.");
    	}
      } 
    }
  }
397166
def loads(s, as_dict=False, *args, **kwargs):
    
    if as_dict or (not isinstance(s, six.string_types)):
        s = json.dumps(s)
    kwargs['object_hook'] = object_hook
    return json.loads(s, *args, **kwargs)
175549
def update_resources_from_dict(self, res, types=None, names=None, 
                                   languages=None):
        
        UpdateResourcesFromDict(self.filename, res, types, names, 
                                languages)
386739
def load(source, **kwargs) -> JsonObj:
    
    if isinstance(source, str):
        if '://' in source:
            req = Request(source)
            req.add_header("Accept", "application/json, text/json;q=0.9")
            with urlopen(req) as response:
                jsons = response.read()
        else:
            with open(source) as f:
                jsons = f.read()
    elif hasattr(source, "read"):
        jsons = source.read()
    else:
        raise TypeError("Unexpected type {} for source {}".format(type(source), source))

    return loads(jsons, **kwargs)
973251
def install_json_params(self):
        """"""
        if not self._install_json_params:
            for param in self.install_json.get('params') or []:
                self._install_json_params[param.get('name')] = param
        return self._install_json_params
1135623
function propertiesToJSON(properties) {

        var obj = {},
            i,
            l = properties.length;

        for (i = 0; i < l; i++) {
            addToJSONRecursively(
                properties[i].name.split('.'),
                propertyToString(properties[i]),
                obj
            );
        }

        return obj;
    }
456250
def _load_resource_listing(resource_listing):
    
    try:
        with open(resource_listing) as resource_listing_file:
            return simplejson.load(resource_listing_file)
    # If not found, raise a more user-friendly error.
    except IOError:
        raise ResourceListingNotFoundError(
            'No resource listing found at {0}. Note that your json file '
            'must be named {1}'.format(resource_listing, API_DOCS_FILENAME)
        )
1005602
function loadJson5(urlOrResource) {
  var resource;
  if (urlOrResource instanceof Resource) {
    resource = urlOrResource;
  } else {
    resource = new Resource({
      url: urlOrResource,
      headers: defaultHeaders
    });
  }

  return resource.fetchText().then(function(value) {
    return json5.parse(value);
  });
}
1134252
public  <T extends Resource>  byte[] getResourceAsByteArray(T resource, boolean pretty, boolean isJson) {
    ByteArrayOutputStream baos = null;
    byte[] byteArray = null;
    try {
      baos = new ByteArrayOutputStream();
      IParser parser = null;
      if(isJson) {
        parser = new JsonParser();
      } else {
        parser = new XmlParser();
      }
      parser.setOutputStyle(pretty ? OutputStyle.PRETTY : OutputStyle.NORMAL);
      parser.compose(baos, resource);
      baos.close();
      byteArray =  baos.toByteArray();
      baos.close();
    } catch (Exception e) {
      try{
        baos.close();
      }catch(Exception ex) {
        throw new EFhirClientException("Error closing output stream", ex);
      }
      throw new EFhirClientException("Error converting output stream to byte array", e);
    }
    return byteArray;
  }
465891
public void loadProperties(Properties properties) throws IOException {
        userSettings.putAll(properties);
        loadDataSource(obdaModel, userSettings);
    }
1165522
public <T> T loadResources(Class<T> type, String... resources) {
    return loadResources(type, Arrays.asList(resources));
  }
119869
def _build_resource_from_properties(obj, filter_fields):
    
    partial = {}
    for filter_field in filter_fields:
        api_field = obj._PROPERTY_TO_API_FIELD.get(filter_field)
        if api_field is None and filter_field not in obj._properties:
            raise ValueError("No property %s" % filter_field)
        elif api_field is not None:
            partial[api_field] = obj._properties.get(api_field)
        else:
            # allows properties that are not defined in the library
            # and properties that have the same name as API resource key
            partial[filter_field] = obj._properties[filter_field]

    return partial
777003
public void loadFromJson(final Properties props, final InputStream is) throws IOException {
		try {
			((PrefixedProperties) props).loadFromJSON(is);
		} catch (final NoSuchMethodError err) {
			throw new IOException(
					"Cannot load properties JSON file - not using PrefixedProperties: " + err.getMessage());
		}
	}
466015
public static void loadResourcesDefaults(Properties defaultProperties, String propertiesFileName) throws IOException {
        final String resource = Setup.TEMPLATE_RESOURCES_PATH + "/" + propertiesFileName;
        InputStream is = Preferences.class.getClassLoader().getResourceAsStream(
            resource);
        if(null==is) {
            throw new IOException("Unable to load resource: " + resource);
        }
        try {
            defaultProperties.load(is);
        } finally {
            if (null != is) {
                is.close();
            }
        }
    }
889383
function buildResourceMap(resourceDefinitions, start) {
    var map = {};
    if(resourceDefinitions) {
      for(var i = 0, len = resourceDefinitions.length; i < len; i++) {
        addResourceToMap(map, resourceDefinitions[i], start);
      }
    }

    return map;
  }
463694
def convert_json_object_to_pyr_resource(key, val)
      if resources_include?(key) && val.is_a?(Array)
        objectify(key, val)
      elsif resources_include_singular?(key) && val.is_a?(Hash)
        new_response_object(key, val)
      end
    end
865214
private void readResourceCustomFields(net.sf.mpxj.ganttproject.schema.Resource gpResource, Resource mpxjResource)
   {
      //
      // Populate custom field default values
      //
      Map<FieldType, Object> customFields = new HashMap<FieldType, Object>();
      for (Pair<FieldType, String> definition : m_resourcePropertyDefinitions.values())
      {
         customFields.put(definition.getFirst(), definition.getSecond());
      }

      //
      // Update with custom field actual values
      //
      for (CustomResourceProperty property : gpResource.getCustomProperty())
      {
         Pair<FieldType, String> definition = m_resourcePropertyDefinitions.get(property.getDefinitionId());
         if (definition != null)
         {
            //
            // Retrieve the value. If it is empty, use the default.
            //
            String value = property.getValueAttribute();
            if (value.isEmpty())
            {
               value = null;
            }

            //
            // If we have a value,convert it to the correct type
            //
            if (value != null)
            {
               Object result;

               switch (definition.getFirst().getDataType())
               {
                  case NUMERIC:
                  {
                     if (value.indexOf('.') == -1)
                     {
                        result = Integer.valueOf(value);
                     }
                     else
                     {
                        result = Double.valueOf(value);
                     }
                     break;
                  }

                  case DATE:
                  {
                     try
                     {
                        result = m_localeDateFormat.parse(value);
                     }
                     catch (ParseException ex)
                     {
                        result = null;
                     }
                     break;
                  }

                  case BOOLEAN:
                  {
                     result = Boolean.valueOf(value.equals("true"));
                     break;
                  }

                  default:
                  {
                     result = value;
                     break;
                  }
               }

               if (result != null)
               {
                  customFields.put(definition.getFirst(), result);
               }
            }
         }
      }

      for (Map.Entry<FieldType, Object> item : customFields.entrySet())
      {
         if (item.getValue() != null)
         {
            mpxjResource.set(item.getKey(), item.getValue());
         }
      }
   }