# Wikipedia viewer - problem parsing json data

**URL:** <https://forum.freecodecamp.org/t/wikipedia-viewer-problem-parsing-json-data/151937>\
**Category:** General\
**Created:** [October 7, 2017, 4:38pm UTC](https://forum.freecodecamp.org/t/wikipedia-viewer-problem-parsing-json-data/151937 "2017-10-07T16:38:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![GreenApple76](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/greenapple76/32/67459_2.png) [@GreenApple76](https://forum.freecodecamp.org/u/GreenApple76)\
**Post date:** [October 7, 2017, 4:38pm UTC](https://forum.freecodecamp.org/t/wikipedia-viewer-problem-parsing-json-data/151937/1 "2017-10-07T16:38:40Z")

</div>

I am having a problem parsing the json data. I am able to form the search url okay to search wikipedia api. I also can successfully open the url in a new window to view the json data. However the search result never appears on my wikipedia viewer app. How can I fix this?

My codepen link is here for [my wikipedia viewer](https://codepen.io/GreenApple/pen/MEQxVg)

Thank you,  
Kevin

---

<div class="post-metadata">

**Author:** ![noyb](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/noyb/32/66148_2.png) [@noyb](https://forum.freecodecamp.org/u/noyb)\
**Post date:** [October 7, 2017, 4:56pm UTC](https://forum.freecodecamp.org/t/wikipedia-viewer-problem-parsing-json-data/151937/2 "2017-10-07T16:56:53Z")

</div>

Hey. Check the output of the request more carefully. It should be `json.query.search` and not `json.search`. Also, you don’t need the cors website; you can just pass the `origin=*` parameter in the wikipedia URL like:

```auto
var url = 'https://en.wikipedia.org/w/api.php?origin=*&action=query&utf8&list=search&format=json&srsearch='

```

See the post below for more info about it:

> [@$.getJSON not working on this pen](https://forum.freecodecamp.org/t/getjson-not-working-on-this-pen/151355/6):
>
> When you make a request from a domain to another, you basically have to tell where you are coming from. The “\*” in origin, is used to make anonymous requests and allow access from anywhere (which in your case, is codepen). As to where to insert it, you just need to add it in your URL like any other paramater. In fact, you don’t even need the urlEnding var; you can add &format=json where you prefer; order isn’t important: "https://en.wikipedia.org/w/api.php?origin=\*&action=query&format=json&li…

---

<div class="post-metadata">

**Author:** ![GreenApple76](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/greenapple76/32/67459_2.png) [@GreenApple76](https://forum.freecodecamp.org/u/GreenApple76)\
**Post date:** [October 7, 2017, 5:28pm UTC](https://forum.freecodecamp.org/t/wikipedia-viewer-problem-parsing-json-data/151937/3 "2017-10-07T17:28:45Z")

</div>

That solved my problem. I appreciate your help. Thank you also for the information about cors.

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [January 17, 2021, 8:38pm UTC](https://forum.freecodecamp.org/t/wikipedia-viewer-problem-parsing-json-data/151937/4 "2021-01-17T20:38:04Z")

</div>


