Read RTBS JSON Output into PHP

<?php
	$str_example_json = '
		{
			"overall_rolls": 26404,
			"single_streak_record": 34,
			"grand_melee": 5443,
			"ruthless_precision": 5380,
			"true_bearing": 5491,
			"broadsides": 5466,
			"skull_and_crossbones": 5467,
			"buried_treasure": 5562,
			"1_buff": 20797,
			"2_buff": 5341,
			"5_buff": 266,
			"streak_ends": {
				"1": 1162,
				"2": 941,
				"3": 744,
				"4": 578,
				"5": 472,
				"6": 375,
				"7": 287,
				"8": 220,
				"9": 181,
				"10": 156,
				"11": 105,
				"12": 71,
				"13": 68,
				"14": 51,
				"15": 43,
				"16": 31,
				"17": 21,
				"18": 17,
				"19": 21,
				"20": 15,
				"21": 19,
				"22": 4,
				"23": 8,
				"24": 1,
				"25": 5,
				"26": 4,
				"27": 1,
				"28": 1,
				"29": 0,
				"30": 2,
				"31": 2,
				"32": 0,
				"33": 0,
				"34": 1
			}
		}
	';
	
	$arr_json = json_decode($str_example_json, true);

	$str_overall_rolls = $arr_json['overall_rolls'];
	$str_single_streak_record = $arr_json['single_streak_record'];
	$str_grand_melee = $arr_json['grand_melee'];
	$str_ruthless_precision= $arr_json['ruthless_precision'];
	$str_true_bearing = $arr_json['true_bearing'];
	$str_broadsides = $arr_json['broadsides'];
	$str_skull_and_crossbones= $arr_json['skull_and_crossbones'];
	$str_buried_treasure = $arr_json['buried_treasure'];
	$str_1_buff = $arr_json['1_buff'];
	$str_2_buff = $arr_json['2_buff'];
	$str_5_buff = $arr_json['5_buff'];
	$arr_streak_ends = $arr_json['streak_ends'];
  • Expires: Never
  • Author: Michigras
  • Created: Feb 9, 2017
  • Edited: Nov 5, 2018
  • Language: PHP

Reply to Paste

A live preview will appear here...

Replies

Title Language Created Expires:
af9c6ea3 Auto-Detect Apr 19, 2019 Never