transform the JSON return by Ariane server to local object
        :param json_obj: the JSON returned by Ariane server
        :return: a new InjectorCachedGear
518881
def json_2_injector_gear(json_obj):
        
        LOGGER.debug("InjectorCachedGear.json_2_injector_gear")
        return InjectorCachedGear(
            gear_id=json_obj['gearId'],
            gear_name=json_obj['gearName'],
            gear_description=json_obj['gearDescription'],
            gear_admin_queue=json_obj['gearAdminQueue'],
            running=json_obj['running']
        )
1084836
private static Object toJson(JsonObject obj, JsonBuilderFactory factory) {
		return obj.toJson(factory.createJsonBuilder());
	}
700570
def json(self):
        

        if self.fresh():
            return self.__cached_json
        # noinspection PyAttributeOutsideInit
        self.__last_read_time = time.time()
        self.__cached_json = self._router.get_instance(org_id=self.organizationId, instance_id=self.instanceId).json()

        return self.__cached_json
952393
def json_encode(obj, serialize):
    
    if hasattr(obj, 'to_dict'):
        return obj.to_dict(serialize=serialize)
    elif isinstance(obj, datetime):
        return obj.date().isoformat()
    elif isinstance(obj, date):
        return obj.isoformat()
    elif isinstance(obj, ProxyDict):
        return dict(obj)
    elif isinstance(obj, ProxyList):
        return list(obj)
    elif is_iterable_but_not_string(obj):
        return list(obj)
1030703
def load_json(ffp, custom=None, verbose=0):
    
    data = json.load(open(ffp))
    return ecp_dict_to_objects(data, custom, verbose=verbose)
1197529
def pre_process_json(obj):
    
    if type(obj) is dict:
        new_dict = {}
        for key, value in obj.items():
            new_dict[key] = pre_process_json(value)
        return new_dict

    elif type(obj) is list:
        new_list = []
        for item in obj:
            new_list.append(pre_process_json(item))
        return new_list

    elif hasattr(obj, 'todict'):
        return dict(obj.todict())

    else:
        try:
            json.dumps(obj)
        except TypeError:
            try:
                json.dumps(obj.__dict__)
            except TypeError:
                return str(obj)
            else:
                return obj.__dict__
        else:
            return obj
49614
def load_json(json_list, into=None):
    
    def l2t(obj):
      if isinstance(obj, list):
        return tuple(l2t(L) for L in obj)
      elif isinstance(obj, dict):
        return frozendict(obj)
      else:
        return obj
    return TypeFactory.load(l2t(json_list), into=into)
42556
def to_json(self, model):
        
        # Get the basic Json object from the super class
        obj = super(DefaultModelRegistry, self).to_json(model)
        # Add model parameter
        obj['parameters'] = [
            para.to_json() for para in model.parameters
        ]
        obj['outputs'] = model.outputs.to_json()
        return obj
945517
def injector_gear_2_json(self):
        
        LOGGER.debug("InjectorCachedGear.injector_gear_2_json")
        json_obj = {
            'gearId': self.id,
            'gearName': self.name,
            'gearAdminQueue': self.admin_queue,
            'gearDescription': self.description,
            'running': 'true' if self.running else 'false'
        }
        return json_obj
380292
public static JsonNode toJson(Object obj, ClassLoader classLoader) {
        ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
        if (classLoader != null) {
            Thread.currentThread().setContextClassLoader(classLoader);
        }
        try {
            if (obj == null) {
                return NullNode.instance;
            }
            ObjectMapper mapper = poolMapper.borrowObject();
            if (mapper != null) {
                try {
                    return mapper.valueToTree(obj);
                } finally {
                    poolMapper.returnObject(mapper);
                }
            }
            throw new SerializationException("No ObjectMapper instance avaialble!");
        } catch (Exception e) {
            throw e instanceof SerializationException ? (SerializationException) e
                    : new SerializationException(e);
        } finally {
            Thread.currentThread().setContextClassLoader(oldClassLoader);
        }
    }
419877
def as_json(obj: JsonObj, indent: Optional[str]='   ', **kwargs) -> str:
    
    return obj._as_json_dumps(indent, **kwargs)
154087
def json_data(self, instance, default=None):
        
        value = self.get(instance)
        return value or default
851875
def json_encode(obj: Instance, **kwargs) -> str:
    
    return json.dumps(obj, cls=JsonClassEncoder, **kwargs)
1129220
def JSONObjectReader(registry, fi, deref=False):
    
    for line in fi:
        yield registry.from_json(line, deref=deref)
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
97710
def get(obj: JsonObj, item: str, default: JsonObjTypes=None) -> JsonObjTypes:
    
    return obj._get(item, default)
642514
def _to_json_default(obj):
    
    # Datetime
    if isinstance(obj, datetime.datetime):
        return obj.isoformat()

    # UUID
    if isinstance(obj, uuid.UUID):
        return str(obj)

    # numpy
    if hasattr(obj, 'item'):
        return obj.item()

    # # Enum
    # if hasattr(obj, 'value'):
    #     return obj.value

    try:
        return obj.id
    except Exception:
        raise TypeError('{obj} is not JSON serializable'.format(obj=repr(obj)))