Get post information in drupal function I posted JSON array from my script using jQuery.post , to get the posted data in my drupal module function I am using 

$json = file_get_contents("php://input");


but is there a better way or a 'drupal-way' to get posted data in a drupal function?
Assuming that you're using Drupal 7, take a look at the module Content as JSON. This should take care of the details and put you within the realm of the "drupal-way". There's also the Services module which might be overkill for what you're doing.

If you stick with file_get_contents then don't forget json_decode:

$received = file_get_contents("drupal://input"); // Use inputstream module.
$received = json_decode($received, TRUE);


Then you can play around as much as you'd like with the $received value.

Additionally, the inputstream module is invaluable in letting you get to the input stream more than once (if you try using php://input more than once, the second time, and those following, will return NULL).