Returns the IGeneratorSet represented by the given JSON object.
765275
public static IGeneratorSet asGeneratorSet( JsonObject json)
    {
    GeneratorSet generatorSet = new GeneratorSet();

    // Get generator definitions
    json.keySet().stream()
      .forEach( function -> {
        try
          {
          generatorSet.addGenerator( validFunction( function), asGenerator( json.getJsonObject( function)));
          }
        catch( GeneratorSetException e)
          {
          throw new GeneratorSetException( String.format( "Error defining generator for function=%s", function), e);
          }
        });

    return generatorSet;
    }
869801
def json_iterator(hdr, rowlist, lang, add_vtype=False):
    
    # Return the header row
    yield hdr if not add_vtype else ((h, 'type') for h in hdr)
    # Now the data rows
    for row in rowlist:
        if lang and not lang_match_json(row, hdr, lang):
            continue
        yield ((row[c]['value'], jtype(row[c])) if c in row else ('', '')
               for c in hdr)
380325
function immutableSet(source, exprPaths, pathsStart, pathsLen, value, data) {
    if (pathsStart >= pathsLen) {
        return value;
    }

    if (source == null) {
        source = {};
    }

    var pathExpr = exprPaths[pathsStart];
    var prop = evalExpr(pathExpr, data);
    var result = source;

    if (source instanceof Array) {
        var index = +prop;
        prop = isNaN(index) ? prop : index;

        result = source.slice(0);
        result[prop] = immutableSet(source[prop], exprPaths, pathsStart + 1, pathsLen, value, data);
    }
    else if (typeof source === 'object') {
        result = {};

        for (var key in source) {
            /* istanbul ignore else  */
            if (key !== prop && source.hasOwnProperty(key)) {
                result[key] = source[key];
            }
        }

        result[prop] = immutableSet(source[prop], exprPaths, pathsStart + 1, pathsLen, value, data);
    }

    if (pathExpr.value == null) {
        exprPaths[pathsStart] = {
            type: typeof prop === 'string' ? ExprType.STRING : ExprType.NUMBER,
            value: prop
        };
    }

    return result;
}
325267
public static Attributes fromJSON(Model mo, JSONObject o) throws JSONConverterException {
        Attributes attrs = new DefaultAttributes();
        try {

            JSONObject vms = (JSONObject) o.get("vms");
            if (vms != null) {
                for (Map.Entry<String, Object> e : vms.entrySet()) {
                    String el = e.getKey();
                    VM vm = getVM(mo, Integer.parseInt(el));
                    JSONObject entries = (JSONObject) e.getValue();
                    putAttributes(attrs, vm, entries);
                }
            }

            JSONObject nodes = (JSONObject) o.get("nodes");
            if (nodes != null) {
                for (Map.Entry<String, Object> e : nodes.entrySet()) {
                    String el = e.getKey();
                    Node n = getNode(mo, Integer.parseInt(el));
                    JSONObject entries = (JSONObject) e.getValue();
                    putAttributes(attrs, n, entries);
                }
            }
        } catch (ClassCastException ex) {
            throw new JSONConverterException(ex);
        }
        return attrs;
    }
846601
private void writeJsonArray(String arrayName, List<String> values)
            throws JsonGenerationException, IOException {
        writeJsonArrayStart(arrayName);
        for (String value : values)
            generator.writeString(value);
        writeJsonArrayEnd();
    }
584784
public static String toJsonString(Object obj, ClassLoader classLoader) {
        if (obj == null) {
            return "null";
        }
        ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
        if (classLoader != null) {
            Thread.currentThread().setContextClassLoader(classLoader);
        }
        try {
            ObjectMapper mapper = poolMapper.borrowObject();
            if (mapper != null) {
                try {
                    return mapper.writeValueAsString(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);
        }
    }
227291
private void toJSON(JSONEmitter json) {
        switch (m_type) {
        case ARRAY:
            json.startArray(m_name);
            if (m_children != null) {
                for (UNode childNode : m_children) {
                    if (childNode.isMap()) {
                        json.startObject();
                        childNode.toJSON(json);
                        json.endObject();
                    } else {
                        childNode.toJSON(json);
                    }
                }
            }
            json.endArray();
            break;
            
        case MAP:
            // Return map child modes in name order.
            json.startGroup(m_name);
            if (m_childNodeMap != null) {
                assert m_childNodeMap.size() == m_children.size();
                for (UNode childNode : m_childNodeMap.values()) {
                    childNode.toJSON(json);
                }
            }
            json.endGroup();
            break;
            
        case VALUE:
            if (m_bAltFormat && m_tagName != null) {
                // Generate as "<tag>: {"<name>": "<value>"}
                json.startGroup(m_tagName);
                json.addValue(m_name, m_value);
                json.endGroup();
            } else if (m_parent != null && m_parent.isArray()) {
                if (m_name.equals("value")) {
                    // nameless node: "<value>"
                    json.addValue(m_value);
                } else {
                    // value as an object: {"name": "value"}
                    json.addObject(m_name, m_value);
                }
            } else {
                // Simple case: "<name>": "<value>"
                json.addValue(m_name, m_value);
            }
            break;
            
        default:
            assert false : "Unknown NodeType: " + m_type;
        }
    }
111021
public static SchemaBuilder fromJson(String json) {
        try {
            return JsonSerializer.fromString(json, SchemaBuilder.class);
        } catch (IOException e) {
            throw new IndexException(e, "Unparseable JSON schema: {}: {}", e.getMessage(), json);
        }
    }
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);
        }
    }
515812
@Override
    public T deserialize(String json) {
        ObjectMapper mapper = SequenceElement.mapper();
        try {
            T ret = (T) mapper.readValue(json, targetClass);
            return ret;
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
35026
def for_json(self):
        """"""
        cursor = super(CursorField, self).for_json()
        if cursor is not None:
            # Lambda called immediately, false-positive from pylint on closure scope warning
            # pylint: disable=cell-var-from-loop
            return [getattr(item, 'for_json', lambda: item)() for item in cursor]
1130764
def to_json(self):
        """"""
        sets = self.sets()
        return sorted(sorted(x) for x in sets)
1016626
protected void bodyToJsonUtf8(JsonGenerator generator)
      throws IOException {

    generator.writeObjectField("dataset", datasetLevel);
    generator.writeObjectFieldStart("file");
    for (Map.Entry<String, Map<String, Object>> entry : fileLevel.entrySet()) {
      generator.writeObjectField(entry.getKey(), entry.getValue());
    }
    generator.writeEndObject();

  }
135946
@SuppressWarnings("unchecked")
    public static <T> Set<T> jsonArrayToSet(final JSONArray jsonArray) {
        if (null == jsonArray) {
            return Collections.emptySet();
        }

        final Set<T> ret = new HashSet<T>();

        for (int i = 0; i < jsonArray.length(); i++) {
            ret.add((T) jsonArray.opt(i));
        }

        return ret;
    }
1373422
def set_of(*generators):
    

    class SetOfGenerators(ArbitraryInterface):
        """
        A closure class around the generators specified above, which
        generates a set of the generators.
        """

        @classmethod
        def arbitrary(cls):
            """
            Generate a set of the enclosed generators.
            """
            arbitrary_set = set()
            for generator in generators:
                arbitrary_set |= {
                    arbitrary(generator)
                    # max_size / len(generators):
                    for _ in range(arbitrary(int) % 100)
                }
            return arbitrary_set

    SetOfGenerators.__name__ = ''.join([
        'set_of(', ', '.join(generator.__name__ for generator in generators),
        ')'
    ])
    return SetOfGenerators
333536
public void write( IGeneratorSet generatorSet)
    {
    JsonWriterFactory writerFactory = Json.createWriterFactory( MapBuilder.of( PRETTY_PRINTING, true).build());
    JsonWriter jsonWriter = writerFactory.createWriter( getWriter());

    jsonWriter.write( GeneratorSetJson.toJson( generatorSet));
    }
1364915
public static JsonModelGenerator from(Element element, String classNamePostfix) {
		JsonModelGenerator generator = new JsonModelGenerator(element, classNamePostfix);

		generator.processJsonModel();
		generator.processJsonKeys();
		generator.processStoreJson();

		if (generator.jsonModel.existsBase) {
			JsonModelGenerator baseGenerator =
					from(generator.jsonModel.targetBaseElement, classNamePostfix);
			generator.jsonModel.getInheritKeys().addAll(baseGenerator.jsonModel.getKeys());
		}

		return generator;
	}