Index: src/wp-includes/class.wp-scripts.php
===================================================================
--- src/wp-includes/class.wp-scripts.php	(revision 29749)
+++ src/wp-includes/class.wp-scripts.php	(working copy)
@@ -161,10 +161,10 @@
 		}
 
 		foreach ( (array) $l10n as $key => $value ) {
-			if ( !is_scalar($value) )
+			if ( !is_string($value) )
 				continue;
 
-			$l10n[$key] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8');
+			$l10n[$key] = html_entity_decode( $value, ENT_QUOTES, 'UTF-8');
 		}
 
 		$script = "var $object_name = " . json_encode($l10n) . ';';
Index: tests/phpunit/tests/functions.php
===================================================================
--- tests/phpunit/tests/functions.php	(revision 29749)
+++ tests/phpunit/tests/functions.php	(working copy)
@@ -524,4 +524,26 @@
 		$this->assertCount( 8, $urls );
 		$this->assertEquals( array_slice( $original_urls, 0, 8 ), $urls );
 	}
+
+	/**
+	 * @ticket 25280
+	 */
+	function test_wp_localize_doesnt_convert_types_unexpectedly() {
+		global $wp_scripts;
+
+		$array_to_localize = array(
+			'a_string'  => __( 'Some String' ),
+			'a_number'  => 10,
+			'a_boolean' => true,
+		);
+
+		wp_enqueue_script( 'localize_test','localize_script.js', array(), '1.0.0', true );
+		$localized = wp_localize_script( 'localize_test', 'localized_variable', $array_to_localize );
+
+		$this->assertEquals(
+			'var localized_variable = {"a_string":"Some String","a_number":10,"a_boolean":true};',
+			$wp_scripts->print_extra_script( 'localize_test', false )
+		);
+	}
+
 }
