Changing a JSON value in the db, will cause scope item to turn into a JSON string?
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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from diegopamio/angular-sails-bind
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
diegopamio/angular-sails-bind#34 · 1 comment ·
-
Set headers?Open
Difficulty 4/5 3-5 days Newbie friendliness 25/100
diegopamio/angular-sails-bind#33 · 1 comment ·
-
JSON objectsOpen0 - Backlog
Difficulty 3/5 1-2 days Newbie friendliness 28/100
diegopamio/angular-sails-bind#28 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
0 - Backlog
Difficulty 3/5 1-2 days Newbie friendliness 30/100
diegopamio/angular-sails-bind#20 · 5 comments ·
All issues in diegopamio/angular-sails-bind
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
parse-community/parse-server#10699 · 1 comment ·
Maintainers usually reply within 1 day
-
area: dashboard bug perceived difficulty: 3
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Nitjsefnie-Harness-Commons/daedalus#1179 ·
Maintainers usually reply within 1 day
-
Aframe enhancement javascript
Difficulty 1/5 Under an hour Newbie friendliness 92/100
webarkit/Aframe-nft#17 ·
-
spec-feedback
Difficulty 2/5 1-3 hours Newbie friendliness 75/100