Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Changing a JSON value in the db, will cause scope item to turn into a JSON string?

Open
#23 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
angular, javascript, mysql

Research direction

Reproduce the behavior using the MySQL JSON column, the $scope.animals model, and PUT /animal/1 described in the issue. Trace how the REST API response updates the bound scope object versus how a page refresh parses it; done means the interests value remains an array immediately after the update.

Written by the indexing model from the issue text.

Description

Hey,

So I'm having a little trouble with altering JSON objects in a MySQL database via the RESTapi, when I change a value it will update the bound scope object, but it will change it into a JSON string, then if I refresh the page it will actually parse the JSON correctly.

example:

table:
animal

id:int(ai) | name:string | interests:json

1 | Mr. Sniffles | ["mewing","taking over the world","catnip"]

So the in my controller this will get me a object:
$scope.animals

[{
id: 1,
name: "Mr. Sniffles",
interests: [
"mewing",
"taking over the world",
"catnip"
]
}]

Which is great, but now if I HTTP PUT to /animal/1
interests : '["mewing","catnip"]'

It will change the scope object into:

[{
id: 1,
name: "Mr. Sniffles",
interests: '["mewing","catnip"]' // (string)
}]

Then if I refresh the page it will change it into:

[{
id: 1,
name: "Mr. Sniffles",
interests: [
"mewing",
"catnip"
]
}]

Thanks in advance,

Dominant language
JavaScript
Stars
135
Forks
23
PR merge metrics
No merged PRs in 30d

Getting set up

We have not checked this project's setup files yet. Start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from diegopamio/angular-sails-bind

All issues in diegopamio/angular-sails-bind

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.