Steve North Steve North - 1 year ago 341
Javascript Question

React Native JSON Value of type NSDictionary Cannot be converted to NSString

I have an issue with A React Native (version 0.38.0) app I am trying to develop. I am basically learning as I go.

I am fetching a JSON from a custom API endpoint. I have managed to loop through the JSON and output some data, but the problem is with a

linking to an image. I keep getting the error:

JSON Value of { robj = "" } type NSDictionary Cannot be converted to NSString.

Having had a scout around google, I can't see to make heads nor tail of the issue.

Could anyone please point me in the right direction?

var api = {
getData() {
var url = ''
return fetch(url).then((res) => res.json())

class GetCategories extends Component {
constructor(props) {
this.state = {
categories: []

componentWillMount() {
api.getData().then((res) => {
categories: res

render() {
var catLoop, index){
var catTitle = '',
catImage = '';

catTitle = obj.title;
catImage = obj.image;

return (
<View key={index}>
<Image source={{uri: {catImage}}} style={{width: 400, height: 400}}>


return <View>{catLoop}</View>

Answer Source

This ought to solve your problem...

<Image source={{uri: catImage}} style={{width: 400, height: 400}}>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download