prepare the json config and generate the fields
550764
def parse
            if @config["rows"].nil? || @config["rows"].to_i < 0
                @row_count = 100 # default value
            else
                @row_count = @config["rows"].to_i
            end

            @fields = []
            if @config["fields"].nil? || @config["fields"].empty?
                raise "need 'fields' in the config file and at least 1 field in it"
            end

            @config["fields"].each do |cfg|
                field = {}

                if cfg["name"].nil?
                    raise "field needs a name"
                end
                field[:name] = cfg["name"].to_s

                if cfg["type"].nil? || cfg["type"].empty?
                    raise "field needs a type"
                end
                field[:type] = cfg["type"].to_s

                unless cfg["inject"].nil? || cfg["inject"].empty? || !cfg["inject"].kind_of?(Array)
                    field[:inject] = cfg["inject"].uniq # get rid of duplicates
                end

                unless cfg["rotate"].nil?
                    field[:rotate] = _validate_rotate cfg["rotate"]
                end

                case field[:type]
                when /inc:int/i
                    field[:type] = :inc_int
                    field[:start] = cfg["start"].nil? ? 1 : cfg["start"].to_i
                    field[:step] = cfg["step"].nil? ? 1 : cfg["step"].to_i
                when /rand:int/i
                    field[:type] = :rand_int
                    if cfg["range"].nil?
                        # no range specified? use the default range: [0, 100]
                        field[:min], field[:max] = 0, 100
                    else
                        field[:min], field[:max] = _min_max cfg["range"]
                    end
                when /rand:float/i
                    field[:type] = :rand_float
                    if cfg["range"].nil?
                        # no range specified? use the default range: [0, 1]
                        field[:min], field[:max] = 0, 1
                    else
                        field[:min], field[:max] = _min_max cfg["range"]
                    end
                    field[:precision] = cfg["precision"].nil? ? 1 : cfg["precision"].to_i
                when /rand:char/i
                    field[:type] = :rand_char
                    field[:length] = cfg["length"].nil? ? 10 : cfg["length"]
                    field[:format] = cfg["format"]
                when /fixed/i
                    field[:type] = :fixed
                    raise "need values for fixed type" if cfg["values"].nil?
                    field[:values] = cfg["values"]
                when /faker:\S+/i
                    field[:type] = cfg["type"]
                else
                    raise "unsupported type: #{field[:type]}. supported types: #{_supported_types}"
                end

                fields << field
            end
        end
341590
private function LoadConstantsFromJson()
    {
        $constants_def = Json::Decode(
            file_get_contents($this->definitions_path . "constants.json")
        );

        foreach($constants_def as $header => $namespaces)
        {
            $this->symbols->AddHeader($header);
            
            foreach($namespaces as $namespace => $constants)
            {
                foreach($constants as $constant_name => $constant_data)
                {
                    if(!isset($constant_data["description"]))
                        $constant_data["description"] = "";
                    
                    $constant = new Element\Constant(
                        $constant_name,
                        $constant_data["value"],
                        $constant_data["description"]
                    );

                    $this->symbols->headers[$header]->AddConstant(
                        $constant,
                        $namespace
                    );
                }
            }
        }

        unset($constants_def);
    }
1062382
def to_json
      attributes = {
        "summary" => title,
        "visibility" => visibility,
        "transparency" => transparency,
        "description" => description,
        "location" => location,
        "start" => time_or_all_day(start_time),
        "end" => time_or_all_day(end_time),
        "reminders" => reminders_attributes,
        "guestsCanInviteOthers" => guests_can_invite_others,
        "guestsCanSeeOtherGuests" => guests_can_see_other_guests
      }

      if id
        attributes["id"] = id
      end

      if timezone_needed?
        attributes['start'].merge!(local_timezone_attributes)
        attributes['end'].merge!(local_timezone_attributes)
      end

      attributes.merge!(recurrence_attributes)
      attributes.merge!(color_attributes)
      attributes.merge!(attendees_attributes)
      attributes.merge!(extended_properties_attributes)

      JSON.generate attributes
    end
1013682
public function to_json() {

		// Get the basics from the parent class.
		parent::to_json();

		// Default value.
		$this->json['default'] = $this->setting->default;
		if ( isset( $this->default ) ) {
			$this->json['default'] = $this->default;
		}

		// Required.
		$this->json['required'] = $this->required;

		// Output.
		$this->json['output'] = $this->output;

		// Value.
		$this->json['value'] = $this->value();

		// Choices.
		$this->json['choices'] = $this->choices;

		// The link.
		$this->json['link'] = $this->get_link();

		// The ID.
		$this->json['id'] = $this->id;

		// Translation strings.
		$this->json['l10n'] = $this->l10n();

		// The ajaxurl in case we need it.
		$this->json['ajaxurl'] = admin_url( 'admin-ajax.php' );

		// Input attributes.
		$this->json['inputAttrs'] = '';
		foreach ( $this->input_attrs as $attr => $value ) {
			$this->json['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" ';
		}

		// The kirki-config.
		$this->json['kirkiConfig'] = $this->kirki_config;

		// The option-type.
		$this->json['kirkiOptionType'] = $this->option_type;

		// The option-name.
		$this->json['kirkiOptionName'] = $this->option_name;

		// The preset.
		$this->json['preset'] = $this->preset;

		// The CSS-Variables.
		$this->json['css-var'] = $this->css_vars;

		// Parent setting.
		$this->json['parent_setting'] = $this->parent_setting;

		// Wrapper Attributes.
		$this->json['wrapper_atts'] = $this->wrapper_atts;
	}
931041
def __init(self):
        
        params = {
            "f" : "json",
        }
        json_dict = self._get(self._url, params,
                                 securityHandler=self._securityHandler,
                                 proxy_port=self._proxy_port,
                                 proxy_url=self._proxy_url)
        self._json = json.dumps(json_dict)
        self._json_dict = json_dict
        self.loadAttributes(json_dict=json_dict)
71153
public void setupFields()
    {
        FieldInfo field = null;
        field = new FieldInfo(this, ID, Constants.DEFAULT_FIELD_LENGTH, null, null);
        field.setDataClass(Integer.class);
        field.setHidden(true);
        field = new FieldInfo(this, LAST_CHANGED, Constants.DEFAULT_FIELD_LENGTH, null, null);
        field.setDataClass(Date.class);
        field.setHidden(true);
        field = new FieldInfo(this, DELETED, 10, null, new Boolean(false));
        field.setDataClass(Boolean.class);
        field.setHidden(true);
        field = new FieldInfo(this, CODE, 30, null, null);
        field = new FieldInfo(this, NAME, 30, null, null);
        field = new FieldInfo(this, EXTERNAL_QUEUE_NAME, 60, null, null);
        field = new FieldInfo(this, QUEUE_TYPE, Constants.DEFAULT_FIELD_LENGTH, null, null);
        field = new FieldInfo(this, PRIVATE_QUEUE, 10, null, null);
        field.setDataClass(Boolean.class);
        field = new FieldInfo(this, REVERSE_QUEUE_NAME_ID, Constants.DEFAULT_FIELD_LENGTH, null, null);
        field.setDataClass(Integer.class);
    }
1266906
def gen_def_json_scheme(self, req, method_fields=None):
        
        json_dict = dict(
            ApplicationId=req,
            RequestId=req,
            SessionId=req,
            Password=self.auth.password,
            Username=self.auth.username
        )
        if method_fields is not None:
            json_dict.update(method_fields)
        self.logger.debug(json.dumps(json_dict))
        return json.dumps(json_dict)
1361806
function prepare(config) {
  config = config || {};
  var settings = config.settings && config.settings[constants.PLUGIN_NAME] || {};

  // Set paths, convert string values to array
  settings.paths = objValuesToArray(settings.paths || {});

  // Set allExceptPaths, convert string values to array
  settings.allExceptPaths = objValuesToArray(settings.allExceptPaths || {});

  // Set options for multimatch module
  settings.pathsOptions = settings.pathsOptions || defaults.pathsOptions;

  // Forward plugins from config or use custom ones, remove current plugin
  settings.plugins = toArray(settings.plugins || config.plugins || []);
  var index = settings.plugins.indexOf(constants.PLUGIN_NAME_SHORT);
  if (index > -1) {
    settings.plugins.splice(index, 1);
  }

  settings.cliArgs = settings.cliArgs || [];

  return settings;
}
1162456
def prepare_fields(fields):
    
    def process_item(value):
        if not isinstance(value, NUMERIC_TYPES):
            if isinstance(value, six.string_types):
                # encode utf-8 to unicode, if necessary
                return force_text(value)
            else:
                if isinstance(value, dict):
                    return prepare_fields(value)
                elif isinstance(value, list):
                    return list(map(process_item, value))

                return six.text_type(value)
        return value

    return dict((key, process_item(value))
                for key, value
                in fields.items())
409760
function prepareSelectionData (fields, i) {
    const resp = {};
    for (let field of fields) {
        resp[field.name()] = new Value(field.partialField.data[i], field);
    }
    return resp;
}
1313614
private function SaveConstantsToJson()
    {
        $constants = array();
        
        foreach($this->symbols->headers as $header)
        {
            if(!$header->HasConstants())
                continue;
            
            foreach($header->namespaces as $namespace)
            {
                if(!$namespace->HasConstants())
                    continue;
                
                foreach($namespace->constants as $constant)
                {
                    if(trim($constant->description))
                    {
                        $constants[$header->name][$namespace->name]
                            [$constant->name] = [
                                "value" => $constant->value,
                                "description" => $constant->description
                            ]
                        ;
                    }
                    else
                    {
                        $constants[$header->name][$namespace->name]
                            [$constant->name] = [
                                "value" => $constant->value
                            ]
                        ;
                    }
                }
            }
        }
        
        if(count($constants) > 0)
        {
            file_put_contents(
                $this->definitions_path . "constants.json", 
                Json::Encode($constants)
            );

            unset($constants);
        }
    }
104637
private function init()
    {
        // Define Default Config:
        
        $this->setConfig(self::$default_config);
        
        // Load JSON Config File:
        
        $file = new JsonFile(self::CONFIG_FILE);
        
        // Merge JSON Config (if file exists):
        
        if ($file->exists()) {
            $this->mergeConfig($file->read());
        }
    }
773144
public void setupFields()
    {
        FieldInfo field = null;
        field = new FieldInfo(this, ID, Constants.DEFAULT_FIELD_LENGTH, null, null);
        field.setDataClass(Integer.class);
        field.setHidden(true);
        field = new FieldInfo(this, LAST_CHANGED, Constants.DEFAULT_FIELD_LENGTH, null, null);
        field.setDataClass(Date.class);
        field.setHidden(true);
        field = new FieldInfo(this, DELETED, 10, null, new Boolean(false));
        field.setDataClass(Boolean.class);
        field.setHidden(true);
        field = new FieldInfo(this, KEY_FILENAME, 40, null, null);
        field = new FieldInfo(this, KEY_NUMBER, 2, null, null);
        field.setDataClass(Short.class);
        field = new FieldInfo(this, KEY_FIELD_1, 40, null, null);
        field = new FieldInfo(this, KEY_FIELD_2, 40, null, null);
        field = new FieldInfo(this, KEY_FIELD_3, 40, null, null);
        field = new FieldInfo(this, KEY_FIELD_4, 40, null, null);
        field = new FieldInfo(this, KEY_FIELD_5, 40, null, null);
        field = new FieldInfo(this, KEY_FIELD_6, 40, null, null);
        field = new FieldInfo(this, KEY_FIELD_7, 40, null, null);
        field = new FieldInfo(this, KEY_FIELD_8, 40, null, null);
        field = new FieldInfo(this, KEY_FIELD_9, 40, null, null);
        field = new FieldInfo(this, KEY_NAME, 40, null, null);
        field = new FieldInfo(this, KEY_TYPE, 1, null, null);
        field = new FieldInfo(this, INCLUDE_SCOPE, 10, null, new Integer(0x004));
        field.setDataClass(Integer.class);
    }
973324
def __init(self):
        
        params = {
            "f" : "json"
        }
        json_dict = self._get(url=self._currentURL,
                                 param_dict=params,
                                 securityHandler=self._securityHandler,
                                 proxy_url=self._proxy_url,
                                 proxy_port=self._proxy_port)
        self._json = json.dumps(json_dict)
        self._json_dict = json_dict
        attributes = [attr for attr in dir(self)
                    if not attr.startswith('__') and \
                    not attr.startswith('_')]
        for k,v in json_dict.items():
            if k.lower() == "extensions":
                self._extensions = []
                for ext in v:
                    self._extensions.append(Extension.fromJSON(ext))
                    del ext
            elif k in attributes:
                setattr(self, "_"+ k, json_dict[k])
            else:
                print( k, " - attribute not implemented in manageags.AGSService.")
            del k
            del v
675148
private function generateModuleJsonFile()
    {
        $path = $this->module->getModulePath($this->getName()) . 'module.json';

        if (!$this->filesystem->isDirectory($dir = dirname($path))) {
            $this->filesystem->makeDirectory($dir, 0775, true);
        }

        $this->filesystem->put($path, $this->getStubContents('json'));
    }
119644
def prepare(data):
    """"""
    sha = data.get("sha")
    tree = data.get("tree")
    return {"sha": sha, "tree": tree}
355174
public void setupFields()
    {
        FieldInfo field = null;
        field = new FieldInfo(this, ID, Constants.DEFAULT_FIELD_LENGTH, null, null);
        field.setDataClass(Integer.class);
        field.setHidden(true);
        field = new FieldInfo(this, LAST_CHANGED, Constants.DEFAULT_FIELD_LENGTH, null, null);
        field.setDataClass(Date.class);
        field.setHidden(true);
        field = new FieldInfo(this, DELETED, 10, null, new Boolean(false));
        field.setDataClass(Boolean.class);
        field.setHidden(true);
        field = new FieldInfo(this, USER_ID, Constants.DEFAULT_FIELD_LENGTH, null, null);
        field.setDataClass(Integer.class);
        field = new FieldInfo(this, LOG_TIME, 25, null, null);
        field.setDataClass(Date.class);
        field = new FieldInfo(this, MESSAGE, 127, null, null);
        field = new FieldInfo(this, USER_LOG_TYPE_ID, Constants.DEFAULT_FIELD_LENGTH, null, null);
        field.setDataClass(Integer.class);
    }