Creates a sourcemap view from a JSON string.
186561
def from_bytes(buffer):
        """"""
        buffer = to_bytes(buffer)
        return ProguardView._from_ptr(rustcall(
            _lib.lsm_proguard_mapping_from_bytes,
            buffer, len(buffer)))
368554
public static Map<String, Object> toMap(String jsonString) {
    Map<String, Object> map = new HashMap<>();
    return GSON.fromJson(jsonString, map.getClass());
  }
349657
def from_json(cls, string):
        
        exp_dict = json_to_data(string)
        version = exp_dict.get('version', 0)
        if version == 0:
            return cls.from_dict(exp_dict)
        elif version == 1:
            return cls.from_dict(exp_dict)
        else:
            raise ValueError("Version %d not supported" % version)
852376
@SuppressWarnings("UnusedDeclaration")
  public static Bindings fromJson( String json )
  {
    try
    {
      return PARSER.get().parseJson( json );
    }
    catch( ScriptException e )
    {
      throw new RuntimeException( e );
    }
  }
1242158
def load_json(data=None, path=None, name='NT'):
    
    if data and not path:
        return mapper(json.loads(data), _nt_name=name)
    if path and not data:
        return mapper(json.load(path), _nt_name=name)
    if data and path:
        raise ValueError('expected one source and received two')
588255
public static TransformProcess fromJson(String json) {
        try {
            return JsonMappers.getMapper().readValue(json, TransformProcess.class);
        } catch (IOException e) {
            //TODO proper exception message
            throw new RuntimeException(e);
        }
    }
1028788
def js_source_from_string(template_name, content, output_as_array = false)
      buffer = []
      parsed = @parser.parse(content)
      if parsed.nil?
        raise ParseError.new(@parser.failure_reason, @parser.failure_line, @parser.failure_column)
      end
      
      template_namespace(buffer, template_name)
      template_header(buffer, template_name)
      parsed.elements.each do |element|
        push_content(buffer, element)
      end
      template_footer(buffer)
            
      output_as_array ? buffer : buffer.join("\n")
    end
510192
public SourceMap toJSON() {
        SourceMap map = new SourceMap();
        map.version = this._version;
        map.sources = this._sources.toArray();
        map.names = this._names.toArray();
        map.mappings = serializeMappings();
        map.file = this._file;
        map.sourceRoot = this._sourceRoot;
        if (this._sourcesContents != null) {
            map.sourcesContent = _generateSourcesContent(map.sources, this._sourceRoot);
        }
        return map;
    }
773264
def from_json(cls, json_str):
        """"""
        d = json.loads(json_str)
        return cls.from_dict(d)
1264211
def load_json_from_string(string):
    """"""
    try:
        json_data = json.loads(string)
    except ValueError as e:
        raise ValueError('Given string is not valid JSON: {}'.format(e))
    else:
        return json_data
670647
public Map<String, Object> jsonToMap(String json) {

        /*
         * This if block treats the /v2/accounts/exists response. Currently the endpoint returns the status
         * code on its response body, breaking the JSON conversion.
         */
        if ("200".equals(json)) {
            this.responseBody.put("code", 200);
            return this.responseBody;
        }

        if ("400".equals(json)) {
            this.responseBody.put("code", 400);
            return this.responseBody;
        }

        if ("404".equals(json)) {
            this.responseBody.put("code", 404);
            return this.responseBody;
        }

        if (!json.equals("")) {
            ObjectMapper mapper = new ObjectMapper();
            try {
                this.responseBody = mapper.readValue(json, new TypeReference<Map<String, Object>>(){});
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return this.responseBody;
    }
694318
public static NeuralNetConfiguration fromJson(String json) {
        ObjectMapper mapper = mapper();
        try {
            NeuralNetConfiguration ret = mapper.readValue(json, NeuralNetConfiguration.class);
            return ret;
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
614458
private HashMap<String, JSONObject> buildKeyMap(String content) throws ConnectionException {
        HashMap<String, JSONObject> retMap = new HashMap<String, JSONObject>();
        JSONObject jwksPayload = new JSONObject(content);
        JSONArray keysArray = jwksPayload.getJSONArray("keys");

        for (int i=0;i<keysArray.length();i++) {
            JSONObject object = keysArray.getJSONObject(i);
            String keyId = object.getString("kid");
            retMap.put(keyId,object);
        }
        return retMap;
    }
1343878
public static Map<String, Object> parseJsonString(String json) throws IOException {
        ObjectMapper mapper = new ObjectMapper();
        TypeReference<HashMap<String, Object>> typeRef = new TypeReference<HashMap<String, Object>>() {
        };
        return mapper.readValue(json, typeRef);
    }
75672
public static Map<String, String> parse2Map(String json) {

        Type stringStringMap = new TypeToken<Map<String, String>>() {
        }.getType();

        Gson gson = new Gson();
        Map<String, String> map = gson.fromJson(json, stringStringMap);

        return map;
    }
1243086
private Map<String, String> getDependenciesFromJson(JSONObject json, String keyJson) {
        Map<String, String> nameVersionMap = new HashMap<>();
        if (json.has(keyJson)) {
            JSONObject optionals = json.getJSONObject(keyJson);
            Iterator<String> keys = optionals.keys();
            while (keys.hasNext()) {
                String key = keys.next();
                nameVersionMap.put(key, optionals.getString(key));
            }
        }
        return nameVersionMap;
    }
313722
public void parse(SourceMapObject sourceMapObject, SourceMapSupplier sectionSupplier)
      throws SourceMapParseException {
    if (sourceMapObject.getVersion() != 3) {
      throw new SourceMapParseException("Unknown version: " + sourceMapObject.getVersion());
    }

    String file = sourceMapObject.getFile();
    if (file != null && file.isEmpty()) {
      throw new SourceMapParseException("File entry is empty");
    }

    if (sourceMapObject.getSections() != null) {
      // Looks like a index map, try to parse it that way.
      parseMetaMap(sourceMapObject, sectionSupplier);
      return;
    }

    lineCount = sourceMapObject.getLineCount();
    sourceRoot = sourceMapObject.getSourceRoot();
    sources = sourceMapObject.getSources();
    sourcesContent = sourceMapObject.getSourcesContent();
    names = sourceMapObject.getNames();

    if (lineCount >= 0) {
      lines = new ArrayList<>(lineCount);
    } else {
      lines = new ArrayList<>();
    }

    // The value type of each extension is the native JSON type (e.g. JsonObject, or JSONObject
    // when compiled with GWT).
    extensions.putAll(sourceMapObject.getExtensions());
    new MappingBuilder(sourceMapObject.getMappings()).build();
  }