How to parse json accepted from android app in Rails -


how parse json data sent android app. suppoce have method in controller inside have parse json data.

suppoce android app able send json provided url. believe in order data android app have provide url android application.

the major question json stored, access via parameters hash?

try this

in controller create 1 method , call in before_action e.g.

before_action :parse_json_data_to_params  def parse_json_data_to_params   params.merge!(activesupport::json.decode(request.raw_post)) end 

plese dont forget write except block in front of bfore_action because raise error requests.


Comments

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -