-1

I have an html5 banner created with flash cc. The platform I am using to display/run the ad does not accept JSON files. How do I take the info from the JSON and put it either into my .html or .js file so I can eliminate the JSON all together.

william.eyidi
  • 2,315
  • 4
  • 27
  • 39
  • Try this: `var yourJSON='json'` – Rayon Oct 26 '15 at 15:38
  • 1
    JSON is a subset of JavaScript, so you... just put it in the file. – ssube Oct 26 '15 at 15:40
  • This question is a bit broad to fit properly on stackoverflow. Is the json file static or created dynamically? Whave have you tried? Also, keep in mind that json stands for JavaScript Object Notation and hence can be parsed easily into an object/array. I also think this may be a duplicate: http://stackoverflow.com/questions/4935632/parse-json-in-javascript – k0pernikus Oct 26 '15 at 16:43
  • think of validating the correct answer @Dawn – william.eyidi Oct 28 '15 at 15:21

2 Answers2

0

Assign the JSON data to a normal javascript variable inside of a <script> element in your HTML file.

Jason
  • 31,834
  • 7
  • 59
  • 78
0

You have these two approaches:

HMTL

<script type='text/javascript'>
   var jsonContent = JSON.parse("{name: 'json content in html'}");
</script>

javascript

var jsonContent = JSON.parse("{name: 'json content in javascript file'}");
william.eyidi
  • 2,315
  • 4
  • 27
  • 39