Reads the JSON representation of the document from ELSAPI.
             Returns True if successful; else, False.
485637
def read(self, els_client = None):
        """"""
        if super().read(self.__payload_type, els_client):
            return True
        else:
            return False
172022
def read_json_document(title):
    
    if not title.endswith('.json'):
        juicer.utils.Log.log_warn("File name (%s) does not end with '.json', appending it automatically." % title)
        title += '.json'

    if not os.path.exists(title):
        raise IOError("Could not find file: '%s'" % title)

    f = open(title, 'r')
    doc = f.read()
    f.close()

    return load_json_str(doc)
950715
function isJSON (file) {
  try {
    JSON.parse(file.contents.toString());
    return true;
  } catch (err) {
    return false;
  }
}
149810
def read_json(self, xblock):
        
        self._warn_deprecated_outside_JSONField()
        return self.to_json(self.read_from(xblock))
949087
def _ReadAppJsonFile(self, relative_path):
    
    try:
      with open(os.path.join(sys.path[0], relative_path), 'r') as f:
        return json.load(f)
    except (IOError, ValueError):
      return None
421033
def document
      json = Net::HTTP.get_response URI.parse(query_string(@query))
      json.body
    end
994159
def read(path, create_file=False):
        
        if create_file:
            with open(str(path), 'a+') as data_file:
                data_file.seek(0)
                return json.load(data_file)

        else:
            with open(str(path)) as data_file:
                return json.load(data_file)
918641
def _read_jsonl(filepath, kwargs):
    """"""
    with open(filepath) as data_file:
        data = [json.loads(line, **kwargs)
                for line in data_file
                if len(line) > 0]
    return data
219568
def json? value
      begin
        return false unless value.is_a? String
        MultiJson.load(value)
        true
      rescue MultiJson::ParseError
        false
      end
    end
1127577
def validate_json(file):
    """"""
    max_file_size = current_app.config.get(
        'PREVIEWER_MAX_FILE_SIZE_BYTES', 1 * 1024 * 1024)
    if file.size > max_file_size:
        return False

    with file.open() as fp:
        try:
            json.loads(fp.read().decode('utf-8'))
            return True
        except:
            return False
433432
def read_json(self):
        
        line = self.stdin.readline()
        if line == '':
            raise EOFError()
        return json.loads(line)
1314954
def decode_json_body():
    
    raw_data = request.body.read()

    try:
        return json.loads(raw_data)
    except ValueError as e:
        raise HTTPError(400, e.__str__())
207444
def _is_json(string):
        
        try:
            if isinstance(string, bytes):
                string = string.decode("utf-8")
                json.loads(string)
            elif isinstance(string, str):
                json.loads(string)
            else:
                raise TypeError("Expecting <class 'str'> or <class 'bytes'>, but {} was passed".format(type(string)))
            return string

        except ValueError:
            return False
1205132
def read_geojson(cls, path_or_json_or_string):
        """"""
        assert path_or_json_or_string
        data = None
        if isinstance(path_or_json_or_string, (dict, list)):
            data = path_or_json_or_string
        try:
            data = json.loads(path_or_json_or_string)
        except ValueError:
            pass
        try:
            path = path_or_json_or_string
            if path.endswith('.gz') or path.endswith('.gzip'):
                import gzip
                contents = gzip.open(path, 'r').read().decode('utf-8')
            else:
                contents = open(path, 'r').read()
            data = json.loads(contents)
        except FileNotFoundError:
            pass
        # TODO web address
        assert data, 'MapData accepts a valid geoJSON object, geoJSON string, or path to a geoJSON file'
        return cls(cls._read_geojson_features(data))
934273
public static Document read(@NonNull Resource resource) throws IOException {
      Type mapType = new TypeToken<Map<String, Object>>() {
      }.getType();
      Gson gson = new Gson();
      //Load the document to a map
      Map<String, Object> json = gson.fromJson(resource.readToString(), mapType);

      //Create the initial document using raw content
      Document doc = DocumentFactory.getInstance().createRaw(json.getOrDefault("id", Val.NULL).toString(),
                                                             json.getOrDefault("content", "").toString());

      //Add document attributes
      if (json.containsKey("attributes")) {
         Map<String, Object> attributes = Cast.as(json.get("attributes"));
         attributes.forEach((k, av) -> {
            AttributeType attrType = Types.attribute(k);
            Object val = attrType.getValueType().decode(av);
            if (val != null) {
               doc.put(attrType, val);
            }
         });
      }

      //Set completed annotations
      if (json.containsKey("completed")) {
         Map<String, Object> completed = Cast.as(json.get("completed"));
         completed
            .forEach((k, av) -> {
               AnnotatableType type = Types.from(k);
               doc.getAnnotationSet().setIsCompleted(type, true, av.toString());
            });
      }

      //Create the annotations
      AtomicLong maxAnnotationId = new AtomicLong(-1);
      if (json.containsKey("annotations")) {
         List<Object> annotations = Cast.as(json.get("annotations"));
         annotations
            .forEach(v -> {
               Map<String, Object> vv = Cast.as(v);

               //Create new annotation
               Annotation annotation = doc.annotationBuilder()
                                          .type(AnnotationType.create(vv.get("type").toString()))
                                          .start(((Number) vv.get("start")).intValue())
                                          .end(((Number) vv.get("end")).intValue())
                                          .createAttached();

               //Read in and set id and update max id value
               annotation.setId(((Number) vv.get("id")).longValue());
               maxAnnotationId.getAndUpdate(old -> old < annotation.getId() ? annotation.getId() : old);

               //Read in the attributes (map of types and values)
               Cast.<Map<String, Object>>as(vv.getOrDefault("attributes", Collections.emptyMap())).forEach(
                  (k, av) -> {
                     AttributeType attrType = Types.attribute(k);
                     Object val = attrType.getValueType().decode(av);
                     if (val != null) {
                        annotation.put(attrType, val);
                     }
                  });

               if (vv.containsKey("relations")) {
                  //Read in the relations (a list of maps containing type, value, and target)
                  Cast.<List<Object>>as(vv.get("relations"))
                     .stream()
                     .map(Cast::<Map<String, Object>>as)
                     .forEach(rel -> annotation.add(new Relation(RelationType.create(rel.get("type").toString()),
                                                                 rel.get("value").toString(),
                                                                 ((Number) rel.get("target")).longValue())));
               }
            });

         //Set the next annotation id
         doc.idGenerator.set(maxAnnotationId.get() + 1);
      }

      return doc;
   }
949667
def read_json_integer
      @context.read(@reader)
      if (@context.escapeNum)
        read_json_syntax_char(@@kJSONStringDelimiter)
      end
      str = read_json_numeric_chars

      begin
        num = Integer(str);
      rescue
        raise ProtocolException.new(ProtocolException::INVALID_DATA, "Expected numeric value; got \"#{str}\"")
      end

      if (@context.escapeNum)
        read_json_syntax_char(@@kJSONStringDelimiter)
      end

      return num
    end
1129220
def JSONObjectReader(registry, fi, deref=False):
    
    for line in fi:
        yield registry.from_json(line, deref=deref)