
Product
Socket Now Supports pylock.toml Files
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
= JSON Mapper by Trond Arve Nordheim - {Binary Marbles}[http://www.binarymarbles.com/]
== NOTICE
This is a project under heavy development. The API is far from stable yet, and the code is very unclean in some places. The API won't be considered stable until full tests are available verifying that all functionality is working as expected.
== Description
A Ruby gem for mapping data from JSON data structures into Ruby class representations.
== Features
== Usage
=== Simple one to one mapping class Model
include JSONMapper
# Map the "id" attribute from the JSON data structure to the id attribute of the class,
# using Integer as the data type
json_attribute :id, Integer
# Map the "model_title" attribute from the JSON data structure to the title attribute of
# the class, using String as the data type
json_attribute :title, :model_title, String
end
=== Complex many to one mapping class Model
include JSONMapper
# Map the "id", "model_id" or "modelid" attribute (whatever is located first) from the
# JSON data structure to the id attribute of the class, using Integer as the data type
json_attribute :id, [ :id, :model_id, :modelid ], Integer
end
=== Associations class AssociatedClass
include JSONMapper
# Map the "id" of the JSON data structure to the id attribute of the class, using
# Integer as the data type
json_attribute :id, Integer
end
class Model
include JSONMapper
# Map the "association" attribute from the JSON data structure to an instance of
# the AssociatedClass class, mapping it to the association attribute of the class.
json_attribute :association, AssociatedClass
# Map all entries in the "associations" array from the JSON data structure to
# an array of AssociatedClass instances, mapping them to the associations attribute
# of the class
json_attributes :associations, AssociatedClass
end
== Requirements
== Installation
$ gem install json_mapper
== Note on Patches/Pull Requests
== Copyright
Copyright (c) 2010 Trond Arve Nordheim. See LICENSE for details.
FAQs
Unknown package
We found that json_mapper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
Security News
Research
Socket uncovered two npm packages that register hidden HTTP endpoints to delete all files on command.
Research
Security News
Malicious Ruby gems typosquat Fastlane plugins to steal Telegram bot tokens, messages, and files, exploiting demand after Vietnam’s Telegram ban.