Backport multi_json dependency revert of #5861 to 3-1-stable

Revert #5861. Feature-detect which MultiJson API to use.
Conflicts:
	activesupport/activesupport.gemspec

This backports multi_json version depedency changes as applied.

Rationale: #5861

Patch by sferik (cherry-picked)