lib/autoparse/instance.rb in autoparse-0.3.0 vs lib/autoparse/instance.rb in autoparse-0.3.1

- old
+ new

@@ -11,11 +11,11 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -require 'json' +require 'multi_json' require 'time' require 'autoparse/inflection' require 'addressable/uri' module AutoParse @@ -444,11 +444,19 @@ def to_hash return @data end - def to_json - return ::JSON.generate(self.to_hash) + ## + # Converts the instance value to JSON. + # + # @return [String] The instance value converted to JSON. + # + # @note + # Ignores extra arguments to avoid throwing errors w/ certain JSON + # libraries. + def to_json(*args) + return MultiJson.encode(self.to_hash) end ## # Returns a <code>String</code> representation of the schema instance. #