Method: Proj::PjObject#to_json

Defined in:
lib/proj/pj_object.rb

#to_json(multiline: true, indentation_width: 2) ⇒ String

Returns the json representation for this object

Parameters:

  • multiline (Boolean) (defaults to: true)

    Specifies if output span multiple lines. Defaults to true.

  • indentation_width (Integer) (defaults to: 2)

    Specifies the indentation level. Defaults to 2.

Returns:

  • (String)

See Also:



607
608
609
610
611
612
613
# File 'lib/proj/pj_object.rb', line 607

def to_json(multiline: true, indentation_width: 2)
  options = {"MULTILINE": multiline ? "YES" : "NO",
             "INDENTATION_WIDTH": indentation_width}

  options_ptr = create_options_pointer(options)
  Api.proj_as_projjson(self.context, self, options_ptr).force_encoding('UTF-8')
end